[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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222250 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chad Rosier 2014-11-18 20:34:01 +00:00
parent b7927f100d
commit 5759f0f944

View 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
}