[llvm] r233585 - IR: Use the new DebugLoc API, NFC
Duncan P. N. Exon Smith
dexonsmith at apple.com
Wed May 6 11:02:16 PDT 2015
> On 2015 May 6, at 13:54, Pirama Arumuga Nainar <pirama at google.com> wrote:
>
>
> Hi Duncan, this commit seems to skip the update to lastDL in BitcodeWriter.cpp:WriteFunction. Is that intentional?
No! What a goof-up. Can you file a PR and CC me?
>
> Message: 7
> Date: Mon, 30 Mar 2015 19:40:05 -0000
> From: "Duncan P. N. Exon Smith" <dexonsmith at apple.com>
> To: llvm-commits at cs.uiuc.edu
> Subject: [llvm] r233585 - IR: Use the new DebugLoc API, NFC
> Message-ID: <20150330194005.99A792A6C02F at llvm.org>
> Content-Type: text/plain; charset="utf-8"
> ...
>
> Modified: llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp
> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp?rev=233585&r1=233584&r2=233585&view=diff
> ==============================================================================
> --- llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp (original)
> +++ llvm/trunk/lib/Bitcode/Writer/BitcodeWriter.cpp Mon Mar 30 14:40:05 2015
> @@ -2089,7 +2089,7 @@ static void WriteFunction(const Function
>
> bool NeedsMetadataAttachment = false;
>
> - DebugLoc LastDL;
> + MDLocation *LastDL = nullptr;
>
> // Finally, emit all the instructions, in order.
> for (Function::const_iterator BB = F.begin(), E = F.end(); BB != E; ++BB)
> @@ -2104,10 +2104,9 @@ static void WriteFunction(const Function
> NeedsMetadataAttachment |= I->hasMetadataOtherThanDebugLoc();
>
> // If the instruction has a debug location, emit it.
> - DebugLoc DL = I->getDebugLoc();
> - if (DL.isUnknown()) {
> + MDLocation *DL = I->getDebugLoc();
> + if (!DL)
> continue;
> - }
>
> if (DL == LastDL) {
> // Just repeat the same debug loc as last time.
> @@ -2115,18 +2114,12 @@ static void WriteFunction(const Function
> continue;
> }
>
> - MDNode *Scope, *IA;
> - DL.getScopeAndInlinedAt(Scope, IA, I->getContext());
> - assert(Scope && "Expected valid scope");
> -
> - Vals.push_back(DL.getLine());
> - Vals.push_back(DL.getCol());
> - Vals.push_back(VE.getMetadataOrNullID(Scope));
> - Vals.push_back(VE.getMetadataOrNullID(IA));
> + Vals.push_back(DL->getLine());
> + Vals.push_back(DL->getColumn());
> + Vals.push_back(VE.getMetadataOrNullID(DL->getScope()));
> + Vals.push_back(VE.getMetadataOrNullID(DL->getInlinedAt()));
> Stream.EmitRecord(bitc::FUNC_CODE_DEBUG_LOC, Vals);
> Vals.clear();
> -
> - LastDL = DL;
> }
>
>
More information about the llvm-commits
mailing list