summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-06-27 19:57:53 +0000
committerCraig Topper <craig.topper@gmail.com>2017-06-27 19:57:53 +0000
commit5fe0197622109d8ed51569258c19aaaa4214bbeb (patch)
treea17ce8a777166bc3afeaaa44033def217b8e1fc3 /llvm/test
parentccbb8107764528f0405145fbcbb6eed84fd3f87a (diff)
downloadbcm5719-llvm-5fe0197622109d8ed51569258c19aaaa4214bbeb.tar.gz
bcm5719-llvm-5fe0197622109d8ed51569258c19aaaa4214bbeb.zip
[InstCombine] Propagate nsw flag when turning mul by pow2 into shift when the constant is a vector splat or the scalar bit width is larger than 64-bits
The check to see if we can propagate the nsw flag used m_ConstantInt(uint64_t*&) which doesn't work with splat vectors and has a restriction that the bitwidth of the ConstantInt must be 64-bits are less. This patch changes it to use m_APInt to remove both these issues Differential Revision: https://reviews.llvm.org/D34699 llvm-svn: 306457
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/mul.ll8
1 files changed, 3 insertions, 5 deletions
diff --git a/llvm/test/Transforms/InstCombine/mul.ll b/llvm/test/Transforms/InstCombine/mul.ll
index a775339c7b2..1d9d0a6a9fa 100644
--- a/llvm/test/Transforms/InstCombine/mul.ll
+++ b/llvm/test/Transforms/InstCombine/mul.ll
@@ -300,7 +300,7 @@ define i32 @test32(i32 %X) {
define <2 x i32> @test32vec(<2 x i32> %X) {
; CHECK-LABEL: @test32vec(
-; CHECK-NEXT: [[MUL:%.*]] = shl <2 x i32> [[X:%.*]], <i32 31, i32 31>
+; CHECK-NEXT: [[MUL:%.*]] = shl nsw <2 x i32> [[X:%.*]], <i32 31, i32 31>
; CHECK-NEXT: ret <2 x i32> [[MUL]]
;
%mul = mul nsw <2 x i32> %X, <i32 -2147483648, i32 -2147483648>
@@ -315,20 +315,18 @@ define i32 @test33(i32 %X) {
ret i32 %mul
}
-; TODO: we should propagate nsw flag to the shift here
define <2 x i32> @test33vec(<2 x i32> %X) {
; CHECK-LABEL: @test33vec(
-; CHECK-NEXT: [[MUL:%.*]] = shl <2 x i32> [[X:%.*]], <i32 30, i32 30>
+; CHECK-NEXT: [[MUL:%.*]] = shl nsw <2 x i32> [[X:%.*]], <i32 30, i32 30>
; CHECK-NEXT: ret <2 x i32> [[MUL]]
;
%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: [[MUL:%.*]] = shl nsw i128 [[X:%.*]], 1
; CHECK-NEXT: ret i128 [[MUL]]
;
%mul = mul nsw i128 %X, 2
OpenPOWER on IntegriCloud