[llvm] 8a25bb9 - [InstCombine] Add test for #97330 (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 01:09:01 PDT 2024


Author: Nikita Popov
Date: 2024-07-02T10:08:54+02:00
New Revision: 8a25bb9b391bd13d824b1df43187b4c304011cee

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

LOG: [InstCombine] Add test for #97330 (NFC)

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/known-bits.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/known-bits.ll b/llvm/test/Transforms/InstCombine/known-bits.ll
index d7a8386552067..8520981f63f3e 100644
--- a/llvm/test/Transforms/InstCombine/known-bits.ll
+++ b/llvm/test/Transforms/InstCombine/known-bits.ll
@@ -2025,6 +2025,33 @@ define i8 @simplifydemanded_context(i8 %x, i8 %y) {
   ret i8 %and2
 }
 
+; FIXME: This is a miscompile.
+define i16 @pr97330(i1 %c, ptr %p1, ptr %p2) {
+; CHECK-LABEL: @pr97330(
+; CHECK-NEXT:  entry:
+; CHECK-NEXT:    br i1 [[C:%.*]], label [[EXIT:%.*]], label [[IF:%.*]]
+; CHECK:       if:
+; CHECK-NEXT:    unreachable
+; CHECK:       exit:
+; CHECK-NEXT:    ret i16 1
+;
+entry:
+  %v = load i64, ptr %p1, align 8
+  %conv = trunc i64 %v to i16
+  br i1 %c, label %exit, label %if
+
+if:
+  %cmp = icmp ne i16 %conv, 1
+  %conv2 = zext i1 %cmp to i32
+  store i32 %conv2, ptr %p2, align 4
+  %cmp2 = icmp eq i64 %v, 1
+  call void @llvm.assume(i1 %cmp2)
+  unreachable
+
+exit:
+  ret i16 %conv
+}
+
 declare void @dummy()
 declare void @use(i1)
 declare void @sink(i8)


        


More information about the llvm-commits mailing list