diff options
| author | Dan Gohman <gohman@apple.com> | 2011-02-02 02:02:34 +0000 |
|---|---|---|
| committer | Dan Gohman <gohman@apple.com> | 2011-02-02 02:02:34 +0000 |
| commit | 08d2c98c23824e1b9c28e089f2a31006ab07547f (patch) | |
| tree | e66f8cf8e2db99e793581d7c4e28e5f004af1adf /llvm/test/Transforms | |
| parent | 31f7d460fab75a107fe8f7cbcdfe77582362f1d2 (diff) | |
| download | bcm5719-llvm-08d2c98c23824e1b9c28e089f2a31006ab07547f.tar.gz bcm5719-llvm-08d2c98c23824e1b9c28e089f2a31006ab07547f.zip | |
Fix reassociate to clear optional flags, such as nsw.
llvm-svn: 124712
Diffstat (limited to 'llvm/test/Transforms')
| -rw-r--r-- | llvm/test/Transforms/Reassociate/optional-flags.ll | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/llvm/test/Transforms/Reassociate/optional-flags.ll b/llvm/test/Transforms/Reassociate/optional-flags.ll new file mode 100644 index 00000000000..5ecc7675f8e --- /dev/null +++ b/llvm/test/Transforms/Reassociate/optional-flags.ll @@ -0,0 +1,22 @@ +; RUN: opt -S -reassociate < %s | FileCheck %s +; rdar://8944681 + +; Reassociate should clear optional flags like nsw when reassociating. + +; CHECK: @test0 +; CHECK: %y = add i64 %b, %a +; CHECK: %z = add i64 %y, %c +define i64 @test0(i64 %a, i64 %b, i64 %c) { + %y = add nsw i64 %c, %b + %z = add i64 %y, %a + ret i64 %z +} + +; CHECK: @test1 +; CHECK: %y = add i64 %b, %a +; CHECK: %z = add i64 %y, %c +define i64 @test1(i64 %a, i64 %b, i64 %c) { + %y = add i64 %c, %b + %z = add nsw i64 %y, %a + ret i64 %z +} |

