File: predicated-exit-count.ll

package info (click to toggle)
llvm-toolchain-20 1%3A20.1.6-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 2,111,304 kB
  • sloc: cpp: 7,438,677; ansic: 1,393,822; asm: 1,012,926; python: 241,650; f90: 86,635; objc: 75,479; lisp: 42,144; pascal: 17,286; sh: 10,027; ml: 5,082; perl: 4,730; awk: 3,523; makefile: 3,349; javascript: 2,251; xml: 892; fortran: 672
file content (69 lines) | stat: -rw-r--r-- 3,006 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 4
; RUN: opt -disable-output "-passes=print<scalar-evolution>" -scalar-evolution-classify-expressions=0 < %s 2>&1 | FileCheck %s


define i32 @multiple_exits_with_predicates(ptr %src1, ptr readonly %src2, i32 %end) {
; CHECK-LABEL: 'multiple_exits_with_predicates'
; CHECK-NEXT:  Determining loop execution counts for: @multiple_exits_with_predicates
; CHECK-NEXT:  Loop %for.body: <multiple exits> Unpredictable backedge-taken count.
; CHECK-NEXT:    exit count for for.body: ***COULDNOTCOMPUTE***
; CHECK-NEXT:    predicated exit count for for.body: i32 1023
; CHECK-NEXT:     Predicates:
; CHECK-NEXT:      {1,+,1}<%for.body> Added Flags: <nusw>
; CHECK-EMPTY:
; CHECK-NEXT:    exit count for for.work: ***COULDNOTCOMPUTE***
; CHECK-NEXT:    exit count for for.inc: ***COULDNOTCOMPUTE***
; CHECK-NEXT:    predicated exit count for for.inc: (-1 + (1 umax %end))
; CHECK-NEXT:     Predicates:
; CHECK-NEXT:      {1,+,1}<%for.body> Added Flags: <nusw>
; CHECK-EMPTY:
; CHECK-NEXT:  Loop %for.body: Unpredictable constant max backedge-taken count.
; CHECK-NEXT:  Loop %for.body: Unpredictable symbolic max backedge-taken count.
; CHECK-NEXT:    symbolic max exit count for for.body: ***COULDNOTCOMPUTE***
; CHECK-NEXT:    predicated symbolic max exit count for for.body: i32 1023
; CHECK-NEXT:     Predicates:
; CHECK-NEXT:      {1,+,1}<%for.body> Added Flags: <nusw>
; CHECK-EMPTY:
; CHECK-NEXT:    symbolic max exit count for for.work: ***COULDNOTCOMPUTE***
; CHECK-NEXT:    symbolic max exit count for for.inc: ***COULDNOTCOMPUTE***
; CHECK-NEXT:    predicated symbolic max exit count for for.inc: (-1 + (1 umax %end))
; CHECK-NEXT:     Predicates:
; CHECK-NEXT:      {1,+,1}<%for.body> Added Flags: <nusw>
; CHECK-EMPTY:
; CHECK-NEXT:  Loop %for.body: Predicated constant max backedge-taken count is i32 1023
; CHECK-NEXT:   Predicates:
; CHECK-NEXT:      {1,+,1}<%for.body> Added Flags: <nusw>
; CHECK-NEXT:      {1,+,1}<%for.body> Added Flags: <nusw>
; CHECK-NEXT:  Loop %for.body: Predicated symbolic max backedge-taken count is (1023 umin (-1 + (1 umax %end)))
; CHECK-NEXT:   Predicates:
; CHECK-NEXT:      {1,+,1}<%for.body> Added Flags: <nusw>
; CHECK-NEXT:      {1,+,1}<%for.body> Added Flags: <nusw>
;
entry:
  br label %for.body

for.body:
  %index = phi i8 [ %index.next, %for.inc ], [ 0, %entry ]
  %index.next = add i8 %index, 1
  %conv = zext i8 %index.next to i32
  %cmp.body = icmp ne i32 %conv, 1024
  br i1 %cmp.body, label %for.work, label %exit

for.work:
  %arrayidx = getelementptr inbounds i32, ptr %src1, i8 %index
  %0 = load i32, ptr %arrayidx, align 4
  %arrayidx3 = getelementptr inbounds i32, ptr %src2, i8 %index
  %1 = load i32, ptr %arrayidx3, align 4
  %cmp.work = icmp eq i32 %0, %1
  br i1 %cmp.work, label %found, label %for.inc

for.inc:
  %cmp.inc = icmp ult i32 %conv, %end
  br i1 %cmp.inc, label %for.body, label %exit

found:
  ret i32 1

exit:
  ret i32 0
}