summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/StraightLineStrengthReduce/slsr-mul.ll
diff options
context:
space:
mode:
authorJingyue Wu <jingyue@google.com>2015-05-13 00:03:17 +0000
committerJingyue Wu <jingyue@google.com>2015-05-13 00:03:17 +0000
commit4b6125d788454a7794d5b4a13acc09358105e621 (patch)
tree8efafabcada4ae6a2d59fef0deaf827c81dd696d /llvm/test/Transforms/StraightLineStrengthReduce/slsr-mul.ll
parenta1d39ba940498283f16a3b83507d2e68e269e270 (diff)
downloadbcm5719-llvm-4b6125d788454a7794d5b4a13acc09358105e621.tar.gz
bcm5719-llvm-4b6125d788454a7794d5b4a13acc09358105e621.zip
[SLSR] handles non-canonicalized Mul candidates
such as (2 + B) * S. Tested by @non_canonicalized in slsr-mul.ll llvm-svn: 237216
Diffstat (limited to 'llvm/test/Transforms/StraightLineStrengthReduce/slsr-mul.ll')
-rw-r--r--llvm/test/Transforms/StraightLineStrengthReduce/slsr-mul.ll21
1 files changed, 21 insertions, 0 deletions
diff --git a/llvm/test/Transforms/StraightLineStrengthReduce/slsr-mul.ll b/llvm/test/Transforms/StraightLineStrengthReduce/slsr-mul.ll
index 97e68d5bf51..9b9fc9de4ff 100644
--- a/llvm/test/Transforms/StraightLineStrengthReduce/slsr-mul.ll
+++ b/llvm/test/Transforms/StraightLineStrengthReduce/slsr-mul.ll
@@ -23,6 +23,27 @@ define void @slsr1(i32 %b, i32 %s) {
ret void
}
+define void @non_canonicalized(i32 %b, i32 %s) {
+; CHECK-LABEL: @non_canonicalized(
+ ; foo(b * s);
+ %mul0 = mul i32 %b, %s
+; CHECK: mul i32
+; CHECK-NOT: mul i32
+ call void @foo(i32 %mul0)
+
+ ; foo((1 + b) * s);
+ %b1 = add i32 1, %b
+ %mul1 = mul i32 %b1, %s
+ call void @foo(i32 %mul1)
+
+ ; foo((2 + b) * s);
+ %b2 = add i32 2, %b
+ %mul2 = mul i32 %b2, %s
+ call void @foo(i32 %mul2)
+
+ ret void
+}
+
; foo(a * b)
; foo((a + 1) * b)
; foo(a * (b + 1))
OpenPOWER on IntegriCloud