[llvm] r306427 - [InstCombine] Add test case demonstrating that we don't propagate nsw flag when converting mul by pow2 to shl when the type is larger than 64-bits. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 27 10:16:03 PDT 2017


Author: ctopper
Date: Tue Jun 27 10:16:03 2017
New Revision: 306427

URL: http://llvm.org/viewvc/llvm-project?rev=306427&view=rev
Log:
[InstCombine] Add test case demonstrating that we don't propagate nsw flag when converting mul by pow2 to shl when the type is larger than 64-bits. NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/mul.ll

Modified: llvm/trunk/test/Transforms/InstCombine/mul.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/mul.ll?rev=306427&r1=306426&r2=306427&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/mul.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/mul.ll Tue Jun 27 10:16:03 2017
@@ -324,3 +324,13 @@ define <2 x i32> @test33vec(<2 x i32> %X
   %mul = mul nsw <2 x i32> %X, <i32 1073741824, i32 1073741824>
   ret <2 x i32> %mul
 }
+
+; TODO: we should propagate nsw flag to the shift here, but we only handle i64 and smaller
+define i128 @test34(i128 %X) {
+; CHECK-LABEL: @test34(
+; CHECK-NEXT:    [[MUL:%.*]] = shl i128 [[X:%.*]], 1
+; CHECK-NEXT:    ret i128 [[MUL]]
+;
+  %mul = mul nsw i128 %X, 2
+  ret i128 %mul
+}




More information about the llvm-commits mailing list