File: conditions-iter-order.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 1,998,492 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (75 lines) | stat: -rw-r--r-- 2,454 bytes parent folder | download | duplicates (8)
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
70
71
72
73
74
75
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -passes=ipsccp -S %s | FileCheck %s

declare noalias ptr @malloc(i64)

; Make sure we can eliminate `%tmp17 = icmp ult i32 %tmp10, 3`.

declare void @use(i1)

define internal ptr @spam(ptr %arg) {
; CHECK-LABEL: @spam(
; CHECK-NEXT:  bb:
; CHECK-NEXT:    [[TMP:%.*]] = call ptr @malloc(i64 10368)
; CHECK-NEXT:    [[TMP5:%.*]] = load i32, ptr [[ARG:%.*]], align 8
; CHECK-NEXT:    [[TMP6:%.*]] = add i32 [[TMP5]], 1
; CHECK-NEXT:    [[TMP7:%.*]] = getelementptr inbounds i32, ptr [[ARG]], i32 1
; CHECK-NEXT:    [[TMP10:%.*]] = icmp ne ptr [[TMP7]], null
; CHECK-NEXT:    br i1 [[TMP10]], label [[BB17:%.*]], label [[BB13:%.*]]
; CHECK:       bb13:
; CHECK-NEXT:    [[TMP14:%.*]] = getelementptr inbounds i32, ptr [[ARG]], i32 2
; CHECK-NEXT:    [[TMP15:%.*]] = load i32, ptr [[TMP14]], align 8
; CHECK-NEXT:    [[TMP16:%.*]] = add i32 [[TMP15]], 1
; CHECK-NEXT:    br label [[BB30:%.*]]
; CHECK:       bb17:
; CHECK-NEXT:    [[TMP18:%.*]] = icmp eq i32 [[TMP6]], [[TMP5]]
; CHECK-NEXT:    [[TMP19:%.*]] = getelementptr inbounds i32, ptr [[ARG]], i32 3
; CHECK-NEXT:    [[TMP20:%.*]] = load i32, ptr [[TMP19]], align 8
; CHECK-NEXT:    br i1 [[TMP18]], label [[BB30]], label [[BB13]]
; CHECK:       bb30:
; CHECK-NEXT:    ret ptr [[TMP]]
;
bb:
  %tmp = call ptr @malloc(i64 10368)
  %tmp5 = load i32, ptr %arg, align 8
  %tmp6 = add i32 %tmp5, 1
  %tmp7 = getelementptr inbounds i32, ptr %arg, i32 1
  %tmp10 = icmp ne ptr %tmp7, null
  br i1 %tmp10, label %bb17, label %bb13

bb13:
  %tmp14 = getelementptr inbounds i32, ptr %arg, i32 2
  %tmp15 = load i32, ptr %tmp14, align 8
  %tmp16 = add i32 %tmp15, 1
  br label %bb30

bb17:
  %tmp18 = icmp eq i32 %tmp6, %tmp5
  %tmp19 = getelementptr inbounds i32, ptr %arg, i32 3
  %tmp20 = load i32, ptr %tmp19, align 8
  br i1 %tmp18, label %bb30, label %bb13

bb30:
  ret ptr %tmp
}

define void @spam.1(ptr %arg) {
bb:
  %tmp = alloca ptr, align 8
  %tmp4 = call ptr @spam(ptr %arg)
  br label %bb6

bb6:                                              ; preds = %bb5
  %tmp7 = getelementptr inbounds i32, ptr %tmp4, i32 1
  %tmp10 = load i32, ptr %tmp7, align 8
  %tmp11 = icmp ne i32 %tmp10, 0
  br i1 %tmp11, label %bb6, label %bb15

bb15:                                             ; preds = %bb12
  %tmp17 = icmp ult i32 %tmp10, 3
  call void @use(i1 %tmp17)
  br i1 %tmp17, label %bb6, label %bb24

bb24:
  ret void
}