Skip to content

Commit c4609b7

Browse files
fhahngithub-actions[bot]
authored andcommitted
Automerge: [VPlan] Remove unneeded checks from PlanCFGBuilder::isExternalDef (NFC).
Remove checking if the instruction is in the preheader or exit blocks. Those checks are redundant and handled by checking if the instruction is outside the loop below. Split off as suggested from llvm/llvm-project#137709.
2 parents 26c87d0 + 282af2d commit c4609b7

File tree

1 file changed

+2
-22
lines changed

1 file changed

+2
-22
lines changed

llvm/lib/Transforms/Vectorize/VPlanConstruction.cpp

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -125,35 +125,15 @@ VPBasicBlock *PlainCFGBuilder::getOrCreateVPBB(BasicBlock *BB) {
125125
// Return true if \p Val is considered an external definition. An external
126126
// definition is either:
127127
// 1. A Value that is not an Instruction. This will be refined in the future.
128-
// 2. An Instruction that is outside of the CFG snippet represented in VPlan,
129-
// i.e., is not part of: a) the loop nest, b) outermost loop PH and, c)
130-
// outermost loop exits.
128+
// 2. An Instruction that is outside of the IR region represented in VPlan,
129+
// i.e., is not part of the loop nest.
131130
bool PlainCFGBuilder::isExternalDef(Value *Val) {
132131
// All the Values that are not Instructions are considered external
133132
// definitions for now.
134133
Instruction *Inst = dyn_cast<Instruction>(Val);
135134
if (!Inst)
136135
return true;
137136

138-
BasicBlock *InstParent = Inst->getParent();
139-
assert(InstParent && "Expected instruction parent.");
140-
141-
// Check whether Instruction definition is in loop PH.
142-
BasicBlock *PH = TheLoop->getLoopPreheader();
143-
assert(PH && "Expected loop pre-header.");
144-
145-
if (InstParent == PH)
146-
// Instruction definition is in outermost loop PH.
147-
return false;
148-
149-
// Check whether Instruction definition is in a loop exit.
150-
SmallVector<BasicBlock *> ExitBlocks;
151-
TheLoop->getExitBlocks(ExitBlocks);
152-
if (is_contained(ExitBlocks, InstParent)) {
153-
// Instruction definition is in outermost loop exit.
154-
return false;
155-
}
156-
157137
// Check whether Instruction definition is in loop body.
158138
return !TheLoop->contains(Inst);
159139
}

0 commit comments

Comments
 (0)