[llvm] r221044 - IR: Restore the old behavior of getDISubprogram
David Blaikie
dblaikie at gmail.com
Sat Nov 1 01:40:27 PDT 2014
On Sat, Nov 1, 2014 at 12:57 AM, David Majnemer <david.majnemer at gmail.com>
wrote:
> Author: majnemer
> Date: Sat Nov 1 02:57:14 2014
> New Revision: 221044
>
> URL: http://llvm.org/viewvc/llvm-project?rev=221044&view=rev
> Log:
> IR: Restore the old behavior of getDISubprogram
>
> getDISubprogram was mistakenly thought to contain a bug: we thought we
> might need to try harder if we found a DebugLoc we didn't find.
>
Thanks!
>
> Modified:
> llvm/trunk/lib/IR/DebugInfo.cpp
>
> Modified: llvm/trunk/lib/IR/DebugInfo.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=221044&r1=221043&r2=221044&view=diff
>
> ==============================================================================
> --- llvm/trunk/lib/IR/DebugInfo.cpp (original)
> +++ llvm/trunk/lib/IR/DebugInfo.cpp Sat Nov 1 02:57:14 2014
> @@ -914,17 +914,16 @@ DISubprogram llvm::getDISubprogram(const
>
> DISubprogram llvm::getDISubprogram(const Function *F) {
> // We look for the first instr that has a debug annotation leading back
> to F.
> - const LLVMContext &Ctx = F->getParent()->getContext();
> for (auto &BB : *F) {
> - for (auto &Inst : BB.getInstList()) {
> - DebugLoc DLoc = Inst.getDebugLoc();
> - if (DLoc.isUnknown())
> - continue;
> - const MDNode *Scope = DLoc.getScopeNode(Ctx);
> - DISubprogram Subprogram = getDISubprogram(Scope);
> - if (Subprogram.describes(F))
> - return Subprogram;
> - }
> + auto Inst = std::find_if(BB.begin(), BB.end(), [](const Instruction
> &Inst) {
> + return !Inst.getDebugLoc().isUnknown();
> + });
> + if (Inst == BB.end())
> + continue;
> + DebugLoc DLoc = Inst->getDebugLoc();
> + const MDNode *Scope = DLoc.getScopeNode(F->getParent()->getContext());
> + DISubprogram Subprogram = getDISubprogram(Scope);
> + return Subprogram.describes(F) ? Subprogram : DISubprogram();
> }
>
> return DISubprogram();
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141101/6d328ece/attachment.html>
More information about the llvm-commits
mailing list