[llvm] b6be53d - [ValueTracking] Test for not cond to assume (NFC)

Andreas Jonson via llvm-commits llvm-commits at lists.llvm.org
Sat Feb 15 00:19:29 PST 2025


Author: Andreas Jonson
Date: 2025-02-15T09:19:20+01:00
New Revision: b6be53d4cb92592940618555ba5fbf412c0cfca8

URL: https://github.com/llvm/llvm-project/commit/b6be53d4cb92592940618555ba5fbf412c0cfca8
DIFF: https://github.com/llvm/llvm-project/commit/b6be53d4cb92592940618555ba5fbf412c0cfca8.diff

LOG: [ValueTracking] Test for not cond to 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 c21f8457e82d1..0007cc1518730 100644
--- a/llvm/test/Transforms/InstCombine/assume.ll
+++ b/llvm/test/Transforms/InstCombine/assume.ll
@@ -977,6 +977,24 @@ define i32 @range_15_31_top27(i32 %x) {
   ret i32 %res
 }
 
+define i1 @not_cond_use(i8 %x) {
+; CHECK-LABEL: @not_cond_use(
+; CHECK-NEXT:    [[CMP:%.*]] = icmp eq i8 [[X:%.*]], 0
+; CHECK-NEXT:    tail call void @use(i1 [[CMP]])
+; CHECK-NEXT:    [[NOT:%.*]] = xor i1 [[CMP]], true
+; CHECK-NEXT:    tail call void @llvm.assume(i1 [[NOT]])
+; CHECK-NEXT:    [[RVAL:%.*]] = icmp eq i8 [[X]], 0
+; CHECK-NEXT:    ret i1 [[RVAL]]
+;
+  %cmp = icmp eq i8 %x, 0
+  tail call void @use(i1 %cmp)
+  %not = xor i1 %cmp, true
+  tail call void @llvm.assume(i1 %not)
+  %rval = icmp eq i8 %x, 0
+  ret i1 %rval
+}
+
+declare void @use(i1)
 declare void @llvm.dbg.value(metadata, metadata, metadata)
 
 !llvm.dbg.cu = !{!0}


        


More information about the llvm-commits mailing list