summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Bieneman <beanz@apple.com>2016-03-16 23:17:54 +0000
committerChris Bieneman <beanz@apple.com>2016-03-16 23:17:54 +0000
commit671d0dda7dcb70115a887936e6d8e58b426bd4c2 (patch)
treebbdcee110a7b5f05cfadb1ac0bd704ed394f55ce
parent43e33d61c681f221b03fac71d21044173e33cb0c (diff)
downloadbcm5719-llvm-671d0dda7dcb70115a887936e6d8e58b426bd4c2.tar.gz
bcm5719-llvm-671d0dda7dcb70115a887936e6d8e58b426bd4c2.zip
Upgrade TBAA *before* upgrading intrinsics
Summary: If TBAA is on an intrinsic and it gets upgraded and drops the TBAA we hit an odd assert. We should just upgrade the TBAA first because it doesn't have side-effects. Reviewers: reames, apilipenko, manmanren Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D18229 llvm-svn: 263673
-rw-r--r--llvm/lib/Bitcode/Reader/BitcodeReader.cpp8
-rw-r--r--llvm/test/Assembler/auto_upgrade_intrinsics.ll10
-rw-r--r--llvm/test/Bitcode/auto_upgrade_intrinsics.bcbin0 -> 1672 bytes
3 files changed, 12 insertions, 6 deletions
diff --git a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
index 8d749c29108..fd9a5e5c5ef 100644
--- a/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
+++ b/llvm/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -5334,6 +5334,11 @@ std::error_code BitcodeReader::materializeModule() {
if (!BasicBlockFwdRefs.empty())
return error("Never resolved function from blockaddress");
+ // Upgrading intrinsic calls before TBAA can cause TBAA metadata to be lost,
+ // to prevent this instructions with TBAA tags should be upgraded first.
+ for (unsigned I = 0, E = InstsWithTBAATag.size(); I < E; I++)
+ UpgradeInstWithTBAATag(InstsWithTBAATag[I]);
+
// Upgrade any intrinsic calls that slipped through (should not happen!) and
// delete the old functions to clean up. We can't do this unless the entire
// module is materialized because there could always be another function body
@@ -5349,9 +5354,6 @@ std::error_code BitcodeReader::materializeModule() {
}
UpgradedIntrinsics.clear();
- for (unsigned I = 0, E = InstsWithTBAATag.size(); I < E; I++)
- UpgradeInstWithTBAATag(InstsWithTBAATag[I]);
-
UpgradeDebugInfo(*TheModule);
return std::error_code();
}
diff --git a/llvm/test/Assembler/auto_upgrade_intrinsics.ll b/llvm/test/Assembler/auto_upgrade_intrinsics.ll
index 43fe7e2d460..ed2f6402f60 100644
--- a/llvm/test/Assembler/auto_upgrade_intrinsics.ll
+++ b/llvm/test/Assembler/auto_upgrade_intrinsics.ll
@@ -63,7 +63,7 @@ declare <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptrs, i32, <2 x i1>
define <2 x double> @tests.masked.load(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %passthru) {
; CHECK-LABEL: @tests.masked.load(
; CHECK: @llvm.masked.load.v2f64.p0v2f64
- %res = call <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru)
+ %res = call <2 x double> @llvm.masked.load.v2f64(<2 x double>* %ptr, i32 1, <2 x i1> %mask, <2 x double> %passthru), !tbaa !0
ret <2 x double> %res
}
@@ -72,6 +72,10 @@ declare void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptrs, i3
define void @tests.masked.store(<2 x double>* %ptr, <2 x i1> %mask, <2 x double> %val) {
; CHECK-LABEL: @tests.masked.store(
; CHECK: @llvm.masked.store.v2f64.p0v2f64
- call void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptr, i32 3, <2 x i1> %mask)
+ call void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptr, i32 3, <2 x i1> %mask), !tbaa !0
ret void
-} \ No newline at end of file
+}
+
+!0 = !{!"omnipotent char", !1}
+!1 = !{!"Simple C/C++ TBAA"}
+!2 = !{!"double", !0}
diff --git a/llvm/test/Bitcode/auto_upgrade_intrinsics.bc b/llvm/test/Bitcode/auto_upgrade_intrinsics.bc
new file mode 100644
index 00000000000..9205c8ae4d3
--- /dev/null
+++ b/llvm/test/Bitcode/auto_upgrade_intrinsics.bc
Binary files differ
OpenPOWER on IntegriCloud