summaryrefslogtreecommitdiff
path: root/test/Bitcode
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2010-01-25 21:55:39 +0000
committerDan Gohman <gohman@apple.com>2010-01-25 21:55:39 +0000
commit26793ed9749cf8999b2219d5d52a7b7a05bed505 (patch)
tree8f2abd4e8c099783c4414456acc9ec0e098ede5f /test/Bitcode
parent718fb59801320b8cb22363d115b5fc5ec40dc1f5 (diff)
Fix the bitcode reader to deserialize nuw/nsw/etc. bits properly in the case
of a forward-reference, which doesn't use an "abbrev" encoding. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@94454 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Bitcode')
-rw-r--r--test/Bitcode/flags.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/Bitcode/flags.ll b/test/Bitcode/flags.ll
new file mode 100644
index 00000000000..7b0c5b53889
--- /dev/null
+++ b/test/Bitcode/flags.ll
@@ -0,0 +1,27 @@
+; RUN: llvm-as < %s | llvm-dis > %t0
+; RUN: opt -S < %s > %t1
+; RUN: diff %t0 %t1
+; PR6140
+
+; Make sure the flags are serialized/deserialized properly for both
+; forward and backward references.
+
+define void @foo() nounwind {
+entry:
+ br label %first
+
+second: ; preds = %first
+ %u = add nuw i32 %a, 0 ; <i32> [#uses=0]
+ %s = add nsw i32 %a, 0 ; <i32> [#uses=0]
+ %us = add nuw nsw i32 %a, 0 ; <i32> [#uses=0]
+ %z = add i32 %a, 0 ; <i32> [#uses=0]
+ unreachable
+
+first: ; preds = %entry
+ %a = bitcast i32 0 to i32 ; <i32> [#uses=8]
+ %uu = add nuw i32 %a, 0 ; <i32> [#uses=0]
+ %ss = add nsw i32 %a, 0 ; <i32> [#uses=0]
+ %uuss = add nuw nsw i32 %a, 0 ; <i32> [#uses=0]
+ %zz = add i32 %a, 0 ; <i32> [#uses=0]
+ br label %second
+}