Skip to content

Commit cbb5e24

Browse files
committed
[PredicateInfo] Remove redundant EdgeOnly member (NFC)
EdgeOnly indicates a phi def, which can already be identified by LN_Last with non-null PInfo. Most of the code already reasons in terms of LN_Last instead of EdgeOnly.
1 parent d196124 commit cbb5e24

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

llvm/lib/Transforms/Utils/PredicateInfo.cpp

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ struct ValueDFS {
8989
// Only one of Def or Use will be set.
9090
Value *Def = nullptr;
9191
Use *U = nullptr;
92-
// Neither PInfo nor EdgeOnly participate in the ordering
9392
PredicateBase *PInfo = nullptr;
94-
bool EdgeOnly = false;
9593
};
9694

9795
// Perform a strict weak ordering on instructions and arguments.
@@ -289,26 +287,26 @@ bool PredicateInfoBuilder::stackIsInScope(const ValueDFSStack &Stack,
289287
return false;
290288
// If it's a phi only use, make sure it's for this phi node edge, and that the
291289
// use is in a phi node. If it's anything else, and the top of the stack is
292-
// EdgeOnly, we need to pop the stack. We deliberately sort phi uses next to
293-
// the defs they must go with so that we can know it's time to pop the stack
294-
// when we hit the end of the phi uses for a given def.
295-
if (Stack.back().EdgeOnly) {
290+
// a LN_Last def, we need to pop the stack. We deliberately sort phi uses
291+
// next to the defs they must go with so that we can know it's time to pop
292+
// the stack when we hit the end of the phi uses for a given def.
293+
const ValueDFS &Top = Stack.back();
294+
if (Top.LocalNum == LN_Last && Top.PInfo) {
296295
if (!VDUse.U)
297296
return false;
298297
auto *PHI = dyn_cast<PHINode>(VDUse.U->getUser());
299298
if (!PHI)
300299
return false;
301300
// Check edge
302301
BasicBlock *EdgePred = PHI->getIncomingBlock(*VDUse.U);
303-
if (EdgePred != getBranchBlock(Stack.back().PInfo))
302+
if (EdgePred != getBranchBlock(Top.PInfo))
304303
return false;
305304

306305
// Use dominates, which knows how to handle edge dominance.
307-
return DT.dominates(getBlockEdge(Stack.back().PInfo), *VDUse.U);
306+
return DT.dominates(getBlockEdge(Top.PInfo), *VDUse.U);
308307
}
309308

310-
return (VDUse.DFSIn >= Stack.back().DFSIn &&
311-
VDUse.DFSOut <= Stack.back().DFSOut);
309+
return VDUse.DFSIn >= Top.DFSIn && VDUse.DFSOut <= Top.DFSOut;
312310
}
313311

314312
void PredicateInfoBuilder::popStackUntilDFSScope(ValueDFSStack &Stack,
@@ -636,7 +634,6 @@ void PredicateInfoBuilder::renameUses(SmallVectorImpl<Value *> &OpsToRename) {
636634
VD.DFSIn = DomNode->getDFSNumIn();
637635
VD.DFSOut = DomNode->getDFSNumOut();
638636
VD.PInfo = PossibleCopy;
639-
VD.EdgeOnly = true;
640637
OrderedUses.push_back(VD);
641638
}
642639
} else {

0 commit comments

Comments
 (0)