aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2011-02-02 02:02:34 +0000
committerDan Gohman <gohman@apple.com>2011-02-02 02:02:34 +0000
commit46985a14409486293b689ca07dd07d7482734795 (patch)
treea25a7ef6d4de065e6ed417838f086ca32e80d72f /test
parent1e1901a2945182b9c53f2ed5c2bd471cebfdf29b (diff)
Fix reassociate to clear optional flags, such as nsw.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@124712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/Reassociate/optional-flags.ll22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/Transforms/Reassociate/optional-flags.ll b/test/Transforms/Reassociate/optional-flags.ll
new file mode 100644
index 0000000000..5ecc7675f8
--- /dev/null
+++ b/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
+}