Skip to content

Commit 44b3f96

Browse files
[WinEH] Rename CatchReturnInst::getParentPad, NFC
Summary: Rename to getCatchSwitchParentPad, to make it more clear which ancestor the "parent" in question is. Add a comment pointing out the key feature that the returned pad indicates which funclet contains the successor block. Reviewers: rnk, andrew.w.kaylor, majnemer Subscribers: llvm-commits Differential Revision: http://reviews.llvm.org/D16222 llvm-svn: 257933
1 parent 2ba1295 commit 44b3f96

File tree

4 files changed

+7
-5
lines changed

4 files changed

+7
-5
lines changed

llvm/include/llvm/IR/Instructions.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4152,7 +4152,9 @@ class CatchReturnInst : public TerminatorInst {
41524152
}
41534153
unsigned getNumSuccessors() const { return 1; }
41544154

4155-
Value *getParentPad() const {
4155+
/// Get the parentPad of this catchret's catchpad's catchswitch.
4156+
/// The successor block is implicitly a member of this funclet.
4157+
Value *getCatchSwitchParentPad() const {
41564158
return getCatchPad()->getCatchSwitch()->getParentPad();
41574159
}
41584160

llvm/lib/Analysis/EHPersonalities.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ DenseMap<BasicBlock *, ColorVector> llvm::colorEHFunclets(Function &F) {
9292
BasicBlock *SuccColor = Color;
9393
TerminatorInst *Terminator = Visiting->getTerminator();
9494
if (auto *CatchRet = dyn_cast<CatchReturnInst>(Terminator)) {
95-
Value *ParentPad = CatchRet->getParentPad();
95+
Value *ParentPad = CatchRet->getCatchSwitchParentPad();
9696
if (isa<ConstantTokenNone>(ParentPad))
9797
SuccColor = EntryBlock;
9898
else

llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ void SelectionDAGBuilder::visitCatchRet(const CatchReturnInst &I) {
12061206
// This will be used by the FuncletLayout pass to determine how to order the
12071207
// BB's.
12081208
// A 'catchret' returns to the outer scope's color.
1209-
Value *ParentPad = I.getParentPad();
1209+
Value *ParentPad = I.getCatchSwitchParentPad();
12101210
const BasicBlock *SuccessorColor;
12111211
if (isa<ConstantTokenNone>(ParentPad))
12121212
SuccessorColor = &FuncInfo.Fn->getEntryBlock();

llvm/lib/CodeGen/WinEHPrepare.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -787,7 +787,7 @@ void WinEHPrepare::cloneCommonBlocks(Function &F) {
787787
FixupCatchrets.clear();
788788
for (BasicBlock *Pred : predecessors(OldBlock))
789789
if (auto *CatchRet = dyn_cast<CatchReturnInst>(Pred->getTerminator()))
790-
if (CatchRet->getParentPad() == FuncletToken)
790+
if (CatchRet->getCatchSwitchParentPad() == FuncletToken)
791791
FixupCatchrets.push_back(CatchRet);
792792

793793
for (CatchReturnInst *CatchRet : FixupCatchrets)
@@ -802,7 +802,7 @@ void WinEHPrepare::cloneCommonBlocks(Function &F) {
802802
bool EdgeTargetsFunclet;
803803
if (auto *CRI =
804804
dyn_cast<CatchReturnInst>(IncomingBlock->getTerminator())) {
805-
EdgeTargetsFunclet = (CRI->getParentPad() == FuncletToken);
805+
EdgeTargetsFunclet = (CRI->getCatchSwitchParentPad() == FuncletToken);
806806
} else {
807807
ColorVector &IncomingColors = BlockColors[IncomingBlock];
808808
assert(!IncomingColors.empty() && "Block not colored!");

0 commit comments

Comments
 (0)