From 804f034bd18789e9bbf4c70c10189dd6dbf04128 Mon Sep 17 00:00:00 2001 From: Manman Ren Date: Sat, 28 Sep 2013 00:22:27 +0000 Subject: AutoUpgrade: upgrade from scalar TBAA format to struct-path aware TBAA format. We treat TBAA tags as struct-path aware TBAA format when the first operand is a MDNode and the tag has 3 or more operands. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191593 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Bitcode/Reader/BitcodeReader.cpp | 6 ++++++ lib/Bitcode/Reader/BitcodeReader.h | 2 ++ 2 files changed, 8 insertions(+) (limited to 'lib/Bitcode/Reader') diff --git a/lib/Bitcode/Reader/BitcodeReader.cpp b/lib/Bitcode/Reader/BitcodeReader.cpp index 0c20163c46..e408cd1f98 100644 --- a/lib/Bitcode/Reader/BitcodeReader.cpp +++ b/lib/Bitcode/Reader/BitcodeReader.cpp @@ -17,6 +17,7 @@ #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/InlineAsm.h" #include "llvm/IR/IntrinsicInst.h" +#include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/IR/OperandTraits.h" #include "llvm/IR/Operator.h" @@ -2123,6 +2124,8 @@ bool BitcodeReader::ParseMetadataAttachment() { return Error("Invalid metadata kind ID"); Value *Node = MDValueList.getValueFwdRef(Record[i+1]); Inst->setMetadata(I->second, cast(Node)); + if (I->second == LLVMContext::MD_tbaa) + InstsWithTBAATag.push_back(Inst); } break; } @@ -3134,6 +3137,9 @@ bool BitcodeReader::MaterializeModule(Module *M, std::string *ErrInfo) { } std::vector >().swap(UpgradedIntrinsics); + for (unsigned I = 0, E = InstsWithTBAATag.size(); I < E; I++) + UpgradeInstWithTBAATag(InstsWithTBAATag[I]); + return false; } diff --git a/lib/Bitcode/Reader/BitcodeReader.h b/lib/Bitcode/Reader/BitcodeReader.h index 9533597afa..b284e8cac1 100644 --- a/lib/Bitcode/Reader/BitcodeReader.h +++ b/lib/Bitcode/Reader/BitcodeReader.h @@ -144,6 +144,8 @@ class BitcodeReader : public GVMaterializer { std::vector > AliasInits; std::vector > FunctionPrefixes; + SmallVector InstsWithTBAATag; + /// MAttributes - The set of attributes by index. Index zero in the /// file is for null, and is thus not represented here. As such all indices /// are off by one. -- cgit v1.2.3