[llvm] 9645ced - [InstCombine] Add test for infinite combine loop (NFC)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 03:44:45 PDT 2023


Author: Nikita Popov
Date: 2023-07-24T12:44:36+02:00
New Revision: 9645cedf91e36d9ff15a8efe9d22a80504f2a4e1

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

LOG: [InstCombine] Add test for infinite combine loop (NFC)

Guard against the issue reported at
https://reviews.llvm.org/rG086ee99564af#1230303.

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/and.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/and.ll b/llvm/test/Transforms/InstCombine/and.ll
index cfbf2a85bd3edb..51fc00cf83ec57 100644
--- a/llvm/test/Transforms/InstCombine/and.ll
+++ b/llvm/test/Transforms/InstCombine/and.ll
@@ -2427,3 +2427,14 @@ define i8 @negate_lowbitmask_use2(i8 %x, i8 %y) {
   %r = and i8 %n, %y
   ret i8 %r
 }
+
+ at g = external global i64
+
+define i64 @test_and_or_constexpr_infloop() {
+; CHECK-LABEL: @test_and_or_constexpr_infloop(
+; CHECK-NEXT:    ret i64 or (i64 and (i64 ptrtoint (ptr @g to i64), i64 -8), i64 1)
+;
+  %and = and i64 ptrtoint (ptr @g to i64), -8
+  %or = or i64 %and, 1
+  ret i64 %or
+}


        


More information about the llvm-commits mailing list