summaryrefslogtreecommitdiffstats
path: root/llvm/test/Bitcode/flags.ll
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
commit00f4747bad78c33ba0f78d480db866804f592235 (patch)
treec6d6e9d98c5fdbbe4a33d1183b5935caf8bfaaf9 /llvm/test/Bitcode/flags.ll
parent5cda92820fbba45821548e6f1b9cc58d58574aa5 (diff)
downloadbcm5719-llvm-00f4747bad78c33ba0f78d480db866804f592235.tar.gz
bcm5719-llvm-00f4747bad78c33ba0f78d480db866804f592235.zip
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. llvm-svn: 94454
Diffstat (limited to 'llvm/test/Bitcode/flags.ll')
-rw-r--r--llvm/test/Bitcode/flags.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Bitcode/flags.ll b/llvm/test/Bitcode/flags.ll
new file mode 100644
index 00000000000..7b0c5b53889
--- /dev/null
+++ b/llvm/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
+}
OpenPOWER on IntegriCloud