[llvm-commits] [llvm] r155311 - in /llvm/trunk/test/Transforms/Reassociate: mulfactor.ll mulfactor2.ll
Chandler Carruth
chandlerc at gmail.com
Sun Apr 22 03:11:26 PDT 2012
Author: chandlerc
Date: Sun Apr 22 05:11:26 2012
New Revision: 155311
URL: http://llvm.org/viewvc/llvm-project?rev=155311&view=rev
Log:
Tidy up this test more:
1) Make the checked assertions a bit more precise. We really want the
canonical forms coming out of reassociate to be exactly what is
expected.
2) Remove other passes, and switch the test to actually directly check
that reassociate makes the important transforms and
canonicalizations.
3) Fold in a related test case now that we're using FileCheck. Make the
same tidying changes to it.
Removed:
llvm/trunk/test/Transforms/Reassociate/mulfactor2.ll
Modified:
llvm/trunk/test/Transforms/Reassociate/mulfactor.ll
Modified: llvm/trunk/test/Transforms/Reassociate/mulfactor.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/mulfactor.ll?rev=155311&r1=155310&r2=155311&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/mulfactor.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/mulfactor.ll Sun Apr 22 05:11:26 2012
@@ -1,11 +1,13 @@
-; RUN: opt < %s -reassociate -instcombine -S | FileCheck %s
+; RUN: opt < %s -reassociate -S | FileCheck %s
-define i32 @f(i32 %a, i32 %b) {
-; CHECK: @f
-; CHECK: mul
-; CHECK: mul
-; CHECK-NOT: mul
-; CHECK: ret
+define i32 @test1(i32 %a, i32 %b) {
+; CHECK: @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
@@ -17,3 +19,17 @@
ret i32 %tmp.11
}
+define i32 @test2(i32 %t) {
+; CHECK: @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
+}
+
Removed: llvm/trunk/test/Transforms/Reassociate/mulfactor2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/mulfactor2.ll?rev=155310&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/mulfactor2.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/mulfactor2.ll (removed)
@@ -1,15 +0,0 @@
-; This should turn into one multiply and one add.
-
-; RUN: opt < %s -instcombine -reassociate -instcombine -S > %t
-; RUN: grep mul %t | count 1
-; RUN: grep add %t | count 1
-
-define i32 @main(i32 %t) {
- %tmp.3 = mul i32 %t, 12 ; <i32> [#uses=1]
- %tmp.4 = add i32 %tmp.3, 5 ; <i32> [#uses=1]
- %tmp.6 = mul i32 %t, 6 ; <i32> [#uses=1]
- %tmp.8 = mul i32 %tmp.4, 3 ; <i32> [#uses=1]
- %tmp.9 = add i32 %tmp.8, %tmp.6 ; <i32> [#uses=1]
- ret i32 %tmp.9
-}
-
More information about the llvm-commits
mailing list