@@ -283,8 +283,7 @@ class PredicateInfoBuilder {
283283
284284bool PredicateInfoBuilder::stackIsInScope (const ValueDFSStack &Stack,
285285 const ValueDFS &VDUse) const {
286- if (Stack.empty ())
287- return false ;
286+ assert (!Stack.empty () && " Should not be called with empty stack" );
288287 // If it's a phi only use, make sure it's for this phi node edge, and that the
289288 // use is in a phi node. If it's anything else, and the top of the stack is
290289 // a LN_Last def, we need to pop the stack. We deliberately sort phi uses
@@ -677,22 +676,18 @@ void PredicateInfoBuilder::renameUses(SmallVectorImpl<Value *> &OpsToRename) {
677676 LLVM_DEBUG (dbgs () << " Current DFS numbers are (" << VD.DFSIn << " ,"
678677 << VD.DFSOut << " )\n " );
679678
680- bool ShouldPush = (VD.Def || PossibleCopy);
681- bool OutOfScope = !stackIsInScope (RenameStack, VD);
682- if (OutOfScope || ShouldPush) {
683- // Sync to our current scope.
684- popStackUntilDFSScope (RenameStack, VD);
685- if (ShouldPush) {
686- RenameStack.push_back (VD);
687- }
679+ // Sync to our current scope.
680+ popStackUntilDFSScope (RenameStack, VD);
681+
682+ if (VD.Def || PossibleCopy) {
683+ RenameStack.push_back (VD);
684+ continue ;
688685 }
686+
689687 // If we get to this point, and the stack is empty we must have a use
690688 // with no renaming needed, just skip it.
691689 if (RenameStack.empty ())
692690 continue ;
693- // Skip values, only want to rename the uses
694- if (VD.Def || PossibleCopy)
695- continue ;
696691 if (!DebugCounter::shouldExecute (RenameCounter)) {
697692 LLVM_DEBUG (dbgs () << " Skipping execution due to debug counter\n " );
698693 continue ;
0 commit comments