[PATCH] D87999: [EHStreamer] Ensure CallSiteEntry::{BeginLabel,EndLabel} are non-null. NFC
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 20 22:59:49 PDT 2020
MaskRay created this revision.
MaskRay added reviewers: modimo, rahmanl.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.
MaskRay requested review of this revision.
... to simplify the code a bit.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D87999
Files:
llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
Index: llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
===================================================================
--- llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
+++ llvm/lib/CodeGen/AsmPrinter/EHStreamer.cpp
@@ -269,7 +269,7 @@
// create a call-site entry with no landing pad for the region between the
// try-ranges.
if (SawPotentiallyThrowing && Asm->MAI->usesCFIForEH()) {
- CallSiteEntry Site = { LastLabel, BeginLabel, nullptr, 0 };
+ CallSiteEntry Site = {Asm->getFunctionBegin(), BeginLabel, nullptr, 0};
CallSites.push_back(Site);
PreviousIsInvoke = false;
}
@@ -319,7 +319,9 @@
// function may throw, create a call-site entry with no landing pad for the
// region following the try-range.
if (SawPotentiallyThrowing && !IsSJLJ) {
- CallSiteEntry Site = { LastLabel, nullptr, nullptr, 0 };
+ if (LastLabel == nullptr)
+ LastLabel = Asm->getFunctionBegin();
+ CallSiteEntry Site = {LastLabel, Asm->getFunctionEnd(), nullptr, 0};
CallSites.push_back(Site);
}
}
@@ -514,22 +516,15 @@
MCSymbol *EHFuncBeginSym = Asm->getFunctionBegin();
- MCSymbol *BeginLabel = S.BeginLabel;
- if (!BeginLabel)
- BeginLabel = EHFuncBeginSym;
- MCSymbol *EndLabel = S.EndLabel;
- if (!EndLabel)
- EndLabel = Asm->getFunctionEnd();
-
// Offset of the call site relative to the start of the procedure.
if (VerboseAsm)
Asm->OutStreamer->AddComment(">> Call Site " + Twine(++Entry) + " <<");
- Asm->emitCallSiteOffset(BeginLabel, EHFuncBeginSym, CallSiteEncoding);
+ Asm->emitCallSiteOffset(S.BeginLabel, EHFuncBeginSym, CallSiteEncoding);
if (VerboseAsm)
Asm->OutStreamer->AddComment(Twine(" Call between ") +
- BeginLabel->getName() + " and " +
- EndLabel->getName());
- Asm->emitCallSiteOffset(EndLabel, BeginLabel, CallSiteEncoding);
+ S.BeginLabel->getName() + " and " +
+ S.EndLabel->getName());
+ Asm->emitCallSiteOffset(S.EndLabel, S.BeginLabel, CallSiteEncoding);
// Offset of the landing pad relative to the start of the procedure.
if (!S.LPad) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87999.293074.patch
Type: text/x-patch
Size: 2301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200921/0f6bd24d/attachment.bin>
More information about the llvm-commits
mailing list