diff options
author | Nikita Popov <npopov@redhat.com> | 2025-06-20 09:35:11 +0200 |
---|---|---|
committer | Nikita Popov <npopov@redhat.com> | 2025-06-20 09:35:11 +0200 |
commit | cbb5e244f7564091f9169f525fd8456e68bc028a (patch) | |
tree | e0a9d3468e64e8f0ea69034ac4d3769085cb442f /llvm/lib/Transforms/Utils/PredicateInfo.cpp | |
parent | d196124dd22391f6c967ed569b34632840536c45 (diff) | |
download | llvm-cbb5e244f7564091f9169f525fd8456e68bc028a.zip llvm-cbb5e244f7564091f9169f525fd8456e68bc028a.tar.gz llvm-cbb5e244f7564091f9169f525fd8456e68bc028a.tar.bz2 |
[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.
Diffstat (limited to 'llvm/lib/Transforms/Utils/PredicateInfo.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/PredicateInfo.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/Utils/PredicateInfo.cpp b/llvm/lib/Transforms/Utils/PredicateInfo.cpp index 4a0faab..778287b 100644 --- a/llvm/lib/Transforms/Utils/PredicateInfo.cpp +++ b/llvm/lib/Transforms/Utils/PredicateInfo.cpp @@ -89,9 +89,7 @@ struct ValueDFS { // Only one of Def or Use will be set. Value *Def = nullptr; Use *U = nullptr; - // Neither PInfo nor EdgeOnly participate in the ordering PredicateBase *PInfo = nullptr; - bool EdgeOnly = false; }; // Perform a strict weak ordering on instructions and arguments. @@ -289,10 +287,11 @@ bool PredicateInfoBuilder::stackIsInScope(const ValueDFSStack &Stack, return false; // If it's a phi only use, make sure it's for this phi node edge, and that the // use is in a phi node. If it's anything else, and the top of the stack is - // EdgeOnly, we need to pop the stack. We deliberately sort phi uses next to - // the defs they must go with so that we can know it's time to pop the stack - // when we hit the end of the phi uses for a given def. - if (Stack.back().EdgeOnly) { + // a LN_Last def, we need to pop the stack. We deliberately sort phi uses + // next to the defs they must go with so that we can know it's time to pop + // the stack when we hit the end of the phi uses for a given def. + const ValueDFS &Top = Stack.back(); + if (Top.LocalNum == LN_Last && Top.PInfo) { if (!VDUse.U) return false; auto *PHI = dyn_cast<PHINode>(VDUse.U->getUser()); @@ -300,15 +299,14 @@ bool PredicateInfoBuilder::stackIsInScope(const ValueDFSStack &Stack, return false; // Check edge BasicBlock *EdgePred = PHI->getIncomingBlock(*VDUse.U); - if (EdgePred != getBranchBlock(Stack.back().PInfo)) + if (EdgePred != getBranchBlock(Top.PInfo)) return false; // Use dominates, which knows how to handle edge dominance. - return DT.dominates(getBlockEdge(Stack.back().PInfo), *VDUse.U); + return DT.dominates(getBlockEdge(Top.PInfo), *VDUse.U); } - return (VDUse.DFSIn >= Stack.back().DFSIn && - VDUse.DFSOut <= Stack.back().DFSOut); + return VDUse.DFSIn >= Top.DFSIn && VDUse.DFSOut <= Top.DFSOut; } void PredicateInfoBuilder::popStackUntilDFSScope(ValueDFSStack &Stack, @@ -636,7 +634,6 @@ void PredicateInfoBuilder::renameUses(SmallVectorImpl<Value *> &OpsToRename) { VD.DFSIn = DomNode->getDFSNumIn(); VD.DFSOut = DomNode->getDFSNumOut(); VD.PInfo = PossibleCopy; - VD.EdgeOnly = true; OrderedUses.push_back(VD); } } else { |