X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FIR%2FTypeFinder.cpp;h=e2fb8f84b186f1f86d25171ae3077e01adb0935d;hb=8d8b8915002f4154876106433be6764c78f14411;hp=6796075bfc20f1d26b1c42ecbd2e72637c226804;hpb=5bf8ade9d043d8739b8bfa90e7d7c64ebfe11ef1;p=oota-llvm.git diff --git a/lib/IR/TypeFinder.cpp b/lib/IR/TypeFinder.cpp index 6796075bfc2..e2fb8f84b18 100644 --- a/lib/IR/TypeFinder.cpp +++ b/lib/IR/TypeFinder.cpp @@ -47,6 +47,9 @@ void TypeFinder::run(const Module &M, bool onlyNamed) { if (FI->hasPrefixData()) incorporateValue(FI->getPrefixData()); + if (FI->hasPrologueData()) + incorporateValue(FI->getPrologueData()); + // First incorporate the arguments. for (Function::const_arg_iterator AI = FI->arg_begin(), AE = FI->arg_end(); AI != AE; ++AI) @@ -122,8 +125,13 @@ void TypeFinder::incorporateType(Type *Ty) { /// other ways. GlobalValues, basic blocks, instructions, and inst operands are /// all explicitly enumerated. void TypeFinder::incorporateValue(const Value *V) { - if (const MDNode *M = dyn_cast(V)) - return incorporateMDNode(M); + if (const auto *M = dyn_cast(V)) { + if (const auto *N = dyn_cast(M->getMetadata())) + return incorporateMDNode(N); + if (const auto *MDV = dyn_cast(M->getMetadata())) + return incorporateValue(MDV->getValue()); + return; + } if (!isa(V) || isa(V)) return; @@ -149,11 +157,21 @@ void TypeFinder::incorporateValue(const Value *V) { /// find types hiding within. void TypeFinder::incorporateMDNode(const MDNode *V) { // Already visited? - if (!VisitedConstants.insert(V).second) + if (!VisitedMetadata.insert(V).second) return; // Look in operands for types. - for (unsigned i = 0, e = V->getNumOperands(); i != e; ++i) - if (Value *Op = V->getOperand(i)) - incorporateValue(Op); + for (unsigned i = 0, e = V->getNumOperands(); i != e; ++i) { + Metadata *Op = V->getOperand(i); + if (!Op) + continue; + if (auto *N = dyn_cast(Op)) { + incorporateMDNode(N); + continue; + } + if (auto *C = dyn_cast(Op)) { + incorporateValue(C->getValue()); + continue; + } + } }