File: pr55672.ll

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (101 lines) | stat: -rw-r--r-- 4,846 bytes parent folder | download | duplicates (14)
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
; RUN: opt -S -passes='licm' < %s | FileCheck %s

define void @test_01(ptr addrspace(1) %arg, i32 %arg2) {
; CHECK-LABEL: @test_01(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP103:%.*]] = load atomic ptr addrspace(1), ptr addrspace(1) [[ARG:%.*]] unordered, align 8, !dereferenceable_or_null !0, !align !1
; CHECK-NEXT:    [[TMP117:%.*]] = icmp eq ptr addrspace(1) [[TMP103]], null
; CHECK-NEXT:    [[TMP118:%.*]] = getelementptr inbounds i8, ptr addrspace(1) [[TMP103]], i64 8
; CHECK-NEXT:    br i1 [[TMP117]], label [[FAIL:%.*]], label [[PREHEADER:%.*]]
; CHECK:       fail:
; CHECK-NEXT:    ret void
; CHECK:       preheader:
; CHECK-NEXT:    [[TMP157:%.*]] = load atomic i32, ptr addrspace(1) [[TMP118]] unordered, align 8
; CHECK-NEXT:    br label [[LOOP:%.*]]
; CHECK:       loop:
; CHECK-NEXT:    [[TMP151:%.*]] = phi i32 [ 0, [[PREHEADER]] ], [ [[TMP163:%.*]], [[LOOP]] ]
; CHECK-NEXT:    [[TMP152:%.*]] = icmp ult i32 [[TMP151]], [[ARG2:%.*]]
; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[TMP152]]) [ "deopt"() ]
; CHECK-NEXT:    [[TMP158:%.*]] = icmp ult i32 [[TMP151]], [[TMP157]]
; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[TMP158]]) [ "deopt"() ]
; CHECK-NEXT:    [[TMP163]] = add i32 [[TMP151]], 1
; CHECK-NEXT:    br label [[LOOP]]
;
entry:
  %tmp103 = load atomic ptr addrspace(1), ptr addrspace(1) %arg unordered, align 8, !dereferenceable_or_null !0, !align !1
  %tmp117 = icmp eq ptr addrspace(1) %tmp103, null
  %tmp118 = getelementptr inbounds i8, ptr addrspace(1) %tmp103, i64 8
  br i1 %tmp117, label %fail, label %preheader

fail:                                             ; preds = %entry
  ret void

preheader:                                        ; preds = %entry
  br label %loop

loop:                                             ; preds = %loop, %preheader
  %tmp151 = phi i32 [ 0, %preheader ], [ %tmp163, %loop ]
  %tmp152 = icmp ult i32 %tmp151, %arg2
  call void (i1, ...) @llvm.experimental.guard(i1 %tmp152) [ "deopt"() ]
  %tmp157 = load atomic i32, ptr addrspace(1) %tmp118 unordered, align 8
  %tmp158 = icmp ult i32 %tmp151, %tmp157
  call void (i1, ...) @llvm.experimental.guard(i1 %tmp158) [ "deopt"() ]
  %tmp163 = add i32 %tmp151, 1
  br label %loop
}

; FIXME: should be able to hoist load just as test_01
define void @test_02(ptr addrspace(1) %arg, i32 %arg2) {
; CHECK-LABEL: @test_02(
; CHECK-NEXT:  entry:
; CHECK-NEXT:    [[TMP103:%.*]] = load atomic ptr addrspace(1), ptr addrspace(1) [[ARG:%.*]] unordered, align 8, !dereferenceable_or_null !0, !align !1
; CHECK-NEXT:    [[TMP117:%.*]] = icmp eq ptr addrspace(1) [[TMP103]], null
; CHECK-NEXT:    [[TMP118:%.*]] = getelementptr inbounds i8, ptr addrspace(1) [[TMP103]], i64 8
; CHECK-NEXT:    [[FREEZE:%.*]] = freeze i1 [[TMP117]]
; CHECK-NEXT:    br i1 [[FREEZE]], label [[FAIL:%.*]], label [[PREHEADER:%.*]]
; CHECK:       fail:
; CHECK-NEXT:    ret void
; CHECK:       preheader:
; CHECK-NEXT:    br label [[LOOP:%.*]]
; CHECK:       loop:
; CHECK-NEXT:    [[TMP151:%.*]] = phi i32 [ 0, [[PREHEADER]] ], [ [[TMP163:%.*]], [[LOOP]] ]
; CHECK-NEXT:    [[TMP152:%.*]] = icmp ult i32 [[TMP151]], [[ARG2:%.*]]
; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[TMP152]]) [ "deopt"() ]
; CHECK-NEXT:    [[TMP157:%.*]] = load atomic i32, ptr addrspace(1) [[TMP118]] unordered, align 8
; CHECK-NEXT:    [[TMP158:%.*]] = icmp ult i32 [[TMP151]], [[TMP157]]
; CHECK-NEXT:    call void (i1, ...) @llvm.experimental.guard(i1 [[TMP158]]) [ "deopt"() ]
; CHECK-NEXT:    [[TMP163]] = add i32 [[TMP151]], 1
; CHECK-NEXT:    br label [[LOOP]]
;
entry:
  %tmp103 = load atomic ptr addrspace(1), ptr addrspace(1) %arg unordered, align 8, !dereferenceable_or_null !0, !align !1
  %tmp117 = icmp eq ptr addrspace(1) %tmp103, null
  %tmp118 = getelementptr inbounds i8, ptr addrspace(1) %tmp103, i64 8
  %freeze = freeze i1 %tmp117
  br i1 %freeze, label %fail, label %preheader

fail:                                             ; preds = %entry
  ret void

preheader:                                        ; preds = %entry
  br label %loop

loop:                                             ; preds = %loop, %preheader
  %tmp151 = phi i32 [ 0, %preheader ], [ %tmp163, %loop ]
  %tmp152 = icmp ult i32 %tmp151, %arg2
  call void (i1, ...) @llvm.experimental.guard(i1 %tmp152) [ "deopt"() ]
  %tmp157 = load atomic i32, ptr addrspace(1) %tmp118 unordered, align 8
  %tmp158 = icmp ult i32 %tmp151, %tmp157
  call void (i1, ...) @llvm.experimental.guard(i1 %tmp158) [ "deopt"() ]
  %tmp163 = add i32 %tmp151, 1
  br label %loop
}

; Function Attrs: nocallback nofree nosync willreturn
declare void @llvm.experimental.guard(i1, ...) #0

attributes #0 = { nocallback nofree nosync willreturn }

!0 = !{i64 16}
!1 = !{i64 8}