[llvm] 2d2fc4e - [InstCombine] Test for trunc in align assume (NFC)
Andreas Jonson via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 13 09:51:59 PST 2025
Author: Andreas Jonson
Date: 2025-01-13T18:51:49+01:00
New Revision: 2d2fc4eb6820dfaebb5225c9f5c7275d0f1d0e86
URL: https://github.com/llvm/llvm-project/commit/2d2fc4eb6820dfaebb5225c9f5c7275d0f1d0e86
DIFF: https://github.com/llvm/llvm-project/commit/2d2fc4eb6820dfaebb5225c9f5c7275d0f1d0e86.diff
LOG: [InstCombine] Test for trunc in align assume (NFC)
Added:
Modified:
llvm/test/Transforms/InstCombine/assume.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/assume.ll b/llvm/test/Transforms/InstCombine/assume.ll
index 52f0adf02a3965..2d7bc49b6dcaee 100644
--- a/llvm/test/Transforms/InstCombine/assume.ll
+++ b/llvm/test/Transforms/InstCombine/assume.ll
@@ -34,6 +34,23 @@ define i32 @foo1(ptr %a) #0 {
ret i32 %t0
}
+define i32 @align_assume_trunc_cond(ptr %a) #0 {
+; CHECK-LABEL: @align_assume_trunc_cond(
+; CHECK-NEXT: [[T0:%.*]] = load i32, ptr [[A:%.*]], align 4
+; CHECK-NEXT: [[PTRINT:%.*]] = ptrtoint ptr [[A]] to i64
+; CHECK-NEXT: [[TRUNC:%.*]] = trunc i64 [[PTRINT]] to i1
+; CHECK-NEXT: [[MASKCOND:%.*]] = xor i1 [[TRUNC]], true
+; CHECK-NEXT: tail call void @llvm.assume(i1 [[MASKCOND]])
+; CHECK-NEXT: ret i32 [[T0]]
+;
+ %t0 = load i32, ptr %a, align 4
+ %ptrint = ptrtoint ptr %a to i64
+ %trunc = trunc i64 %ptrint to i1
+ %maskcond = xor i1 %trunc, true
+ tail call void @llvm.assume(i1 %maskcond)
+ ret i32 %t0
+}
+
; Same check as in @foo1, but make sure it works if the assume is first too.
define i32 @foo2(ptr %a) #0 {
More information about the llvm-commits
mailing list