[llvm] ba5170f - [InstCombine] Thwart complexity-based canonicalization in shl-add test (NFC) (#91413)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 17:29:17 PDT 2024


Author: AtariDreams
Date: 2024-05-09T09:29:14+09:00
New Revision: ba5170f430b027c6d290f57d7a5d7ba6ee2b265b

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

LOG: [InstCombine] Thwart complexity-based canonicalization in shl-add test (NFC) (#91413)

Fixed test for #88193

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/lshr.ll b/llvm/test/Transforms/InstCombine/lshr.ll
index 563e669f90353..fa92c1c4b3be4 100644
--- a/llvm/test/Transforms/InstCombine/lshr.ll
+++ b/llvm/test/Transforms/InstCombine/lshr.ll
@@ -397,12 +397,14 @@ define i32 @shl_add_lshr(i32 %x, i32 %c, i32 %y) {
 
 define i32 @shl_add_lshr_comm(i32 %x, i32 %c, i32 %y) {
 ; CHECK-LABEL: @shl_add_lshr_comm(
-; CHECK-NEXT:    [[TMP1:%.*]] = lshr i32 [[Y:%.*]], [[C:%.*]]
+; CHECK-NEXT:    [[Y2:%.*]] = mul i32 [[Y:%.*]], [[Y]]
+; CHECK-NEXT:    [[TMP1:%.*]] = lshr i32 [[Y2]], [[C:%.*]]
 ; CHECK-NEXT:    [[LSHR:%.*]] = add nuw i32 [[TMP1]], [[X:%.*]]
 ; CHECK-NEXT:    ret i32 [[LSHR]]
 ;
   %shl = shl nuw i32 %x, %c
-  %add = add nuw i32 %y, %shl
+  %y2 = mul i32 %y, %y ; thwart complexity-based canonicalization
+  %add = add nuw i32 %y2, %shl
   %lshr = lshr i32 %add, %c
   ret i32 %lshr
 }


        


More information about the llvm-commits mailing list