[Reassociate] Use test cases that can actually be optimized to verify optional
authorChad Rosier <mcrosier@codeaurora.org>
Tue, 18 Nov 2014 20:34:01 +0000 (20:34 +0000)
committerChad Rosier <mcrosier@codeaurora.org>
Tue, 18 Nov 2014 20:34:01 +0000 (20:34 +0000)
flags are cleared.  The reassociation pass was just reordering the leaf nodes
in the previous test cases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222250 91177308-0d34-0410-b5e6-96231b3b80d8

test/Transforms/Reassociate/optional-flags.ll

index b8cd03e8cf4ccd7d7a5b4d16bb6ff9c1545d35db..d8bb29a095483f01e620b4fa7d19554a92682266 100644 (file)
@@ -1,23 +1,24 @@
-; RUN: opt -S -reassociate < %s | FileCheck %s
+; RUN: opt -S -reassociate -dce < %s | FileCheck %s
 ; rdar://8944681
 
 ; Reassociate should clear optional flags like nsw when reassociating.
 
 ; CHECK-LABEL: @test0(
-; CHECK: %y = add i64 %a, %b
-; CHECK: %z = add i64 %c, %y
-define i64 @test0(i64 %a, i64 %b, i64 %c) {
-  %y = add nsw i64 %c, %b
-  %z = add i64 %y, %a
+; CHECK: %z = add i64 %b, 2
+define i64 @test0(i64 %a, i64 %b) {
+  %x = add nsw i64 %a, 2
+  %y = add nsw i64 %x, %b
+  %z = sub nsw i64 %y, %a
   ret i64 %z
 }
 
 ; CHECK-LABEL: @test1(
-; CHECK: %y = add i64 %a, %b
-; CHECK: %z = add i64 %c, %y
-define i64 @test1(i64 %a, i64 %b, i64 %c) {
-  %y = add i64 %c, %b
-  %z = add nsw i64 %y, %a
+; CHECK: %y = mul i64 %a, 6
+; CHECK: %z = sub nsw i64 %y, %a
+define i64 @test1(i64 %a, i64 %b) {
+  %x = add nsw i64 %a, %a
+  %y = mul nsw i64 %x, 3
+  %z = sub nsw i64 %y, %a
   ret i64 %z
 }