@@ -89,9 +89,7 @@ struct ValueDFS {
89
89
// Only one of Def or Use will be set.
90
90
Value *Def = nullptr ;
91
91
Use *U = nullptr ;
92
- // Neither PInfo nor EdgeOnly participate in the ordering
93
92
PredicateBase *PInfo = nullptr ;
94
- bool EdgeOnly = false ;
95
93
};
96
94
97
95
// Perform a strict weak ordering on instructions and arguments.
@@ -289,26 +287,26 @@ bool PredicateInfoBuilder::stackIsInScope(const ValueDFSStack &Stack,
289
287
return false ;
290
288
// If it's a phi only use, make sure it's for this phi node edge, and that the
291
289
// 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 ) {
296
295
if (!VDUse.U )
297
296
return false ;
298
297
auto *PHI = dyn_cast<PHINode>(VDUse.U ->getUser ());
299
298
if (!PHI)
300
299
return false ;
301
300
// Check edge
302
301
BasicBlock *EdgePred = PHI->getIncomingBlock (*VDUse.U );
303
- if (EdgePred != getBranchBlock (Stack. back () .PInfo ))
302
+ if (EdgePred != getBranchBlock (Top .PInfo ))
304
303
return false ;
305
304
306
305
// 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 );
308
307
}
309
308
310
- return (VDUse.DFSIn >= Stack.back ().DFSIn &&
311
- VDUse.DFSOut <= Stack.back ().DFSOut );
309
+ return VDUse.DFSIn >= Top.DFSIn && VDUse.DFSOut <= Top.DFSOut ;
312
310
}
313
311
314
312
void PredicateInfoBuilder::popStackUntilDFSScope (ValueDFSStack &Stack,
@@ -636,7 +634,6 @@ void PredicateInfoBuilder::renameUses(SmallVectorImpl<Value *> &OpsToRename) {
636
634
VD.DFSIn = DomNode->getDFSNumIn ();
637
635
VD.DFSOut = DomNode->getDFSNumOut ();
638
636
VD.PInfo = PossibleCopy;
639
- VD.EdgeOnly = true ;
640
637
OrderedUses.push_back (VD);
641
638
}
642
639
} else {
0 commit comments