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/AsmParser/LLParser.cpp | 7 +++++++ lib/AsmParser/LLParser.h | 2 ++ 2 files changed, 9 insertions(+) (limited to 'lib/AsmParser') diff --git a/lib/AsmParser/LLParser.cpp b/lib/AsmParser/LLParser.cpp index 336518c..2cf2de6 100644 --- a/lib/AsmParser/LLParser.cpp +++ b/lib/AsmParser/LLParser.cpp @@ -19,6 +19,7 @@ #include "llvm/IR/DerivedTypes.h" #include "llvm/IR/InlineAsm.h" #include "llvm/IR/Instructions.h" +#include "llvm/IR/LLVMContext.h" #include "llvm/IR/Module.h" #include "llvm/IR/Operator.h" #include "llvm/IR/ValueSymbolTable.h" @@ -65,6 +66,9 @@ bool LLParser::ValidateEndOfModule() { ForwardRefInstMetadata.clear(); } + for (unsigned I = 0, E = InstsWithTBAATag.size(); I < E; I++) + UpgradeInstWithTBAATag(InstsWithTBAATag[I]); + // Handle any function attribute group forward references. for (std::map >::iterator I = ForwardRefAttrGroups.begin(), E = ForwardRefAttrGroups.end(); @@ -1427,6 +1431,9 @@ bool LLParser::ParseInstructionMetadata(Instruction *Inst, } } + if (MDK == LLVMContext::MD_tbaa) + InstsWithTBAATag.push_back(Inst); + // If this is the end of the list, we're done. } while (EatIfPresent(lltok::comma)); return false; diff --git a/lib/AsmParser/LLParser.h b/lib/AsmParser/LLParser.h index 594281e..ded776c 100644 --- a/lib/AsmParser/LLParser.h +++ b/lib/AsmParser/LLParser.h @@ -107,6 +107,8 @@ namespace llvm { }; DenseMap > ForwardRefInstMetadata; + SmallVector InstsWithTBAATag; + // Type resolution handling data structures. The location is set when we // have processed a use of the type but not a definition yet. StringMap > NamedTypes; -- cgit v1.1