Skip to content

Commit 2d2fc4e

Browse files
committed
[InstCombine] Test for trunc in align assume (NFC)
1 parent 1a7d46f commit 2d2fc4e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

llvm/test/Transforms/InstCombine/assume.ll

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,23 @@ define i32 @foo1(ptr %a) #0 {
3434
ret i32 %t0
3535
}
3636

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+
3754
; Same check as in @foo1, but make sure it works if the assume is first too.
3855

3956
define i32 @foo2(ptr %a) #0 {

0 commit comments

Comments
 (0)