File tree 1 file changed +17
-0
lines changed
llvm/test/Transforms/InstCombine
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,23 @@ define i32 @foo1(ptr %a) #0 {
34
34
ret i32 %t0
35
35
}
36
36
37
+ define i32 @align_assume_trunc_cond (ptr %a ) #0 {
38
+ ; CHECK-LABEL: @align_assume_trunc_cond(
39
+ ; CHECK-NEXT: [[T0:%.*]] = load i32, ptr [[A:%.*]], align 4
40
+ ; CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[A]] to i64
41
+ ; CHECK-NEXT: [[TRUNC:%.*]] = trunc i64 [[PTRINT]] to i1
42
+ ; CHECK-NEXT: [[MASKCOND:%.*]] = xor i1 [[TRUNC]], true
43
+ ; CHECK-NEXT: tail call void @llvm.assume(i1 [[MASKCOND]])
44
+ ; CHECK-NEXT: ret i32 [[T0]]
45
+ ;
46
+ %t0 = load i32 , ptr %a , align 4
47
+ %ptrint = ptrtoint ptr %a to i64
48
+ %trunc = trunc i64 %ptrint to i1
49
+ %maskcond = xor i1 %trunc , true
50
+ tail call void @llvm.assume (i1 %maskcond )
51
+ ret i32 %t0
52
+ }
53
+
37
54
; Same check as in @foo1, but make sure it works if the assume is first too.
38
55
39
56
define i32 @foo2 (ptr %a ) #0 {
You can’t perform that action at this time.
0 commit comments