diff options
| author | Sanjay Patel <spatel@rotateright.com> | 2017-11-09 18:14:24 +0000 |
|---|---|---|
| committer | Sanjay Patel <spatel@rotateright.com> | 2017-11-09 18:14:24 +0000 |
| commit | 0d66010454812149603fb3676e53fb1f521e4a7d (patch) | |
| tree | b473fea89f5e9e3756e18f01038c15caa66783b7 /llvm/test/Transforms/Reassociate/mulfactor.ll | |
| parent | 8c60365d74acff80046c6981f6379368bc9826e8 (diff) | |
| download | bcm5719-llvm-0d66010454812149603fb3676e53fb1f521e4a7d.tar.gz bcm5719-llvm-0d66010454812149603fb3676e53fb1f521e4a7d.zip | |
[Reassociate] don't name values "tmp"; NFCI
The toxic stew of created values named 'tmp' and tests that already have
values named 'tmp' and CHECK lines looking for values named 'tmp' causes
bad things to happen in our test line auto-generation scripts because it
wants to use 'TMP' as a prefix for unnamed values. Use less 'tmp' to
avoid that.
llvm-svn: 317818
Diffstat (limited to 'llvm/test/Transforms/Reassociate/mulfactor.ll')
| -rw-r--r-- | llvm/test/Transforms/Reassociate/mulfactor.ll | 126 |
1 files changed, 60 insertions, 66 deletions
diff --git a/llvm/test/Transforms/Reassociate/mulfactor.ll b/llvm/test/Transforms/Reassociate/mulfactor.ll index 951228ec3cc..ca0dbcde897 100644 --- a/llvm/test/Transforms/Reassociate/mulfactor.ll +++ b/llvm/test/Transforms/Reassociate/mulfactor.ll @@ -2,46 +2,43 @@ define i32 @test1(i32 %a, i32 %b) { ; CHECK-LABEL: @test1( -; CHECK: mul i32 %a, %a -; CHECK-NEXT: mul i32 %a, 2 -; CHECK-NEXT: add -; CHECK-NEXT: mul -; CHECK-NEXT: add -; CHECK-NEXT: ret - -entry: - %tmp.2 = mul i32 %a, %a - %tmp.5 = shl i32 %a, 1 - %tmp.6 = mul i32 %tmp.5, %b - %tmp.10 = mul i32 %b, %b - %tmp.7 = add i32 %tmp.6, %tmp.2 - %tmp.11 = add i32 %tmp.7, %tmp.10 - ret i32 %tmp.11 +; CHECK-NEXT: [[T2:%.*]] = mul i32 %a, %a +; CHECK-NEXT: [[T6:%.*]] = mul i32 %a, 2 +; CHECK-NEXT: [[REASS_ADD:%.*]] = add i32 [[T6]], %b +; CHECK-NEXT: [[REASS_MUL:%.*]] = mul i32 [[REASS_ADD]], %b +; CHECK-NEXT: [[T11:%.*]] = add i32 [[REASS_MUL]], [[T2]] +; CHECK-NEXT: ret i32 [[T11]] +; + %t2 = mul i32 %a, %a + %t5 = shl i32 %a, 1 + %t6 = mul i32 %t5, %b + %t8 = mul i32 %b, %b + %t7 = add i32 %t6, %t2 + %t11 = add i32 %t7, %t8 + ret i32 %t11 } define i32 @test2(i32 %t) { ; CHECK-LABEL: @test2( -; CHECK: mul -; CHECK-NEXT: add -; CHECK-NEXT: ret - -entry: - %a = mul i32 %t, 6 - %b = mul i32 %t, 36 - %c = add i32 %b, 15 - %d = add i32 %c, %a - ret i32 %d +; CHECK-NEXT: [[REASS_MUL:%.*]] = mul i32 %t, 42 +; CHECK-NEXT: [[D:%.*]] = add i32 [[REASS_MUL]], 15 +; CHECK-NEXT: ret i32 [[D]] +; + %a = mul i32 %t, 6 + %b = mul i32 %t, 36 + %c = add i32 %b, 15 + %d = add i32 %c, %a + ret i32 %d } -define i32 @test3(i32 %x) { ; (x^8) +define i32 @test3(i32 %x) { ; CHECK-LABEL: @test3( -; CHECK: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: ret - -entry: +; CHECK-NEXT: [[TMP1:%.*]] = mul i32 %x, %x +; CHECK-NEXT: [[TMP2:%.*]] = mul i32 [[TMP1]], [[TMP1]] +; CHECK-NEXT: [[TMP3:%.*]] = mul i32 [[TMP2]], [[TMP2]] +; CHECK-NEXT: ret i32 [[TMP3]] +; %a = mul i32 %x, %x %b = mul i32 %a, %x %c = mul i32 %b, %x @@ -52,16 +49,15 @@ entry: ret i32 %g } -define i32 @test4(i32 %x) { ; (x^7) +define i32 @test4(i32 %x) { ; CHECK-LABEL: @test4( -; CHECK: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: ret - -entry: +; CHECK-NEXT: [[TMP1:%.*]] = mul i32 %x, %x +; CHECK-NEXT: [[TMP2:%.*]] = mul i32 [[TMP1]], %x +; CHECK-NEXT: [[TMP3:%.*]] = mul i32 [[TMP2]], %x +; CHECK-NEXT: [[F:%.*]] = mul i32 [[TMP3]], [[TMP2]] +; CHECK-NEXT: ret i32 [[F]] +; %a = mul i32 %x, %x %b = mul i32 %a, %x %c = mul i32 %b, %x @@ -71,15 +67,14 @@ entry: ret i32 %f } -define i32 @test5(i32 %x, i32 %y) { ; (x^4) * (y^2) +define i32 @test5(i32 %x, i32 %y) { ; CHECK-LABEL: @test5( -; CHECK: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: ret - -entry: +; CHECK-NEXT: [[TMP1:%.*]] = mul i32 %x, %x +; CHECK-NEXT: [[TMP2:%.*]] = mul i32 [[TMP1]], %y +; CHECK-NEXT: [[TMP3:%.*]] = mul i32 [[TMP2]], [[TMP2]] +; CHECK-NEXT: ret i32 [[TMP3]] +; %a = mul i32 %x, %y %b = mul i32 %a, %y %c = mul i32 %b, %x @@ -88,18 +83,17 @@ entry: ret i32 %e } -define i32 @test6(i32 %x, i32 %y, i32 %z) { ; (x^5) * (y^3) * z +define i32 @test6(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @test6( -; CHECK: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: ret - -entry: +; CHECK-NEXT: [[TMP1:%.*]] = mul i32 %x, %x +; CHECK-NEXT: [[TMP2:%.*]] = mul i32 [[TMP1]], %y +; CHECK-NEXT: [[F:%.*]] = mul i32 %y, %x +; CHECK-NEXT: [[G:%.*]] = mul i32 [[F]], [[TMP2]] +; CHECK-NEXT: [[TMP3:%.*]] = mul i32 [[G]], [[TMP2]] +; CHECK-NEXT: [[H:%.*]] = mul i32 [[TMP3]], %z +; CHECK-NEXT: ret i32 [[H]] +; %a = mul i32 %x, %y %b = mul i32 %a, %x %c = mul i32 %b, %y @@ -111,17 +105,16 @@ entry: ret i32 %h } -define i32 @test7(i32 %x, i32 %y, i32 %z) { ; (x^4) * (y^3) * (z^2) +define i32 @test7(i32 %x, i32 %y, i32 %z) { ; CHECK-LABEL: @test7( -; CHECK: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: mul -; CHECK-NEXT: ret - -entry: +; CHECK-NEXT: [[TMP1:%.*]] = mul i32 %x, %x +; CHECK-NEXT: [[TMP2:%.*]] = mul i32 [[TMP1]], %y +; CHECK-NEXT: [[TMP3:%.*]] = mul i32 [[TMP2]], %z +; CHECK-NEXT: [[TMP4:%.*]] = mul i32 [[TMP3]], %y +; CHECK-NEXT: [[H:%.*]] = mul i32 [[TMP4]], [[TMP3]] +; CHECK-NEXT: ret i32 [[H]] +; %a = mul i32 %y, %x %b = mul i32 %a, %z %c = mul i32 %b, %z @@ -132,3 +125,4 @@ entry: %h = mul i32 %g, %x ret i32 %h } + |

