[llvm] r222250 - [Reassociate] Use test cases that can actually be optimized to verify optional

Chad Rosier mcrosier at codeaurora.org
Tue Nov 18 12:34:01 PST 2014


Author: mcrosier
Date: Tue Nov 18 14:34:01 2014
New Revision: 222250

URL: http://llvm.org/viewvc/llvm-project?rev=222250&view=rev
Log:
[Reassociate] Use test cases that can actually be optimized to verify optional
flags are cleared.  The reassociation pass was just reordering the leaf nodes
in the previous test cases.

Modified:
    llvm/trunk/test/Transforms/Reassociate/optional-flags.ll

Modified: llvm/trunk/test/Transforms/Reassociate/optional-flags.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Reassociate/optional-flags.ll?rev=222250&r1=222249&r2=222250&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Reassociate/optional-flags.ll (original)
+++ llvm/trunk/test/Transforms/Reassociate/optional-flags.ll Tue Nov 18 14:34:01 2014
@@ -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
 }
 





More information about the llvm-commits mailing list