[PATCH] D18229: Upgrade TBAA *before* upgrading intrinsics

Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 16 16:22:58 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL263673: Upgrade TBAA *before* upgrading intrinsics (authored by cbieneman).

Changed prior to commit:
  http://reviews.llvm.org/D18229?vs=50877&id=50891#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D18229

Files:
  llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
  llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll
  llvm/trunk/test/Bitcode/auto_upgrade_intrinsics.bc

Index: llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
===================================================================
--- llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
+++ llvm/trunk/lib/Bitcode/Reader/BitcodeReader.cpp
@@ -5334,6 +5334,11 @@
   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 @@
   }
   UpgradedIntrinsics.clear();
 
-  for (unsigned I = 0, E = InstsWithTBAATag.size(); I < E; I++)
-    UpgradeInstWithTBAATag(InstsWithTBAATag[I]);
-
   UpgradeDebugInfo(*TheModule);
   return std::error_code();
 }
Index: llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll
===================================================================
--- llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll
+++ llvm/trunk/test/Assembler/auto_upgrade_intrinsics.ll
@@ -63,15 +63,19 @@
 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
 }
 
 declare void @llvm.masked.store.v2f64(<2 x double> %val, <2 x double>* %ptrs, i32, <2 x i1> %mask)
 
 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}


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D18229.50891.patch
Type: text/x-patch
Size: 2443 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160316/c2b29560/attachment.bin>


More information about the llvm-commits mailing list