From 5759f0f94453559a22277d8dfc52d29e5e78455c Mon Sep 17 00:00:00 2001 From: Chad Rosier Date: Tue, 18 Nov 2014 20:34:01 +0000 Subject: [PATCH] [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 --- test/Transforms/Reassociate/optional-flags.ll | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/test/Transforms/Reassociate/optional-flags.ll b/test/Transforms/Reassociate/optional-flags.ll index b8cd03e8cf4..d8bb29a0954 100644 --- a/test/Transforms/Reassociate/optional-flags.ll +++ b/test/Transforms/Reassociate/optional-flags.ll @@ -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 } -- 2.34.1