[llvm] 241893f - [PhaseOrdering] add test for mul + sdiv; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 6 10:14:03 PDT 2022


Author: Sanjay Patel
Date: 2022-10-06T13:11:50-04:00
New Revision: 241893f99fd2cfe2fb7e34dfbe34f24af81532b5

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

LOG: [PhaseOrdering] add test for mul + sdiv; NFC

issue #58137

Added: 
    

Modified: 
    llvm/test/Transforms/PhaseOrdering/reassociate-instcombine.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/PhaseOrdering/reassociate-instcombine.ll b/llvm/test/Transforms/PhaseOrdering/reassociate-instcombine.ll
index 613e52b21c73f..2fc37b79e5298 100644
--- a/llvm/test/Transforms/PhaseOrdering/reassociate-instcombine.ll
+++ b/llvm/test/Transforms/PhaseOrdering/reassociate-instcombine.ll
@@ -36,3 +36,18 @@ define i32 @not_reassociate_or_or_not(i32 %a, i32 %b, i32 %c, i32 %d) {
   %b3 = or i32 %b2, %notc
   ret i32 %b3
 }
+
+define i32 @PR58137(i32 %a, i32 %b) {
+; CHECK-LABEL: @PR58137(
+; CHECK-NEXT:    [[MUL:%.*]] = shl i32 [[A:%.*]], 1
+; CHECK-NEXT:    [[MUL1:%.*]] = mul i32 [[MUL]], [[B:%.*]]
+; CHECK-NEXT:    [[MUL2:%.*]] = shl nsw i32 [[A]], 1
+; CHECK-NEXT:    [[DIV:%.*]] = sdiv i32 [[MUL1]], [[MUL2]]
+; CHECK-NEXT:    ret i32 [[DIV]]
+;
+  %mul = mul nsw i32 2, %b
+  %mul1 = mul nsw i32 %mul, %a
+  %mul2 = mul nsw i32 2, %a
+  %div = sdiv i32 %mul1, %mul2
+  ret i32 %div
+}


        


More information about the llvm-commits mailing list