[llvm] [SCCP] Support constant structure in PhiNode (PR #163713)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 16 10:26:55 PDT 2025
================
@@ -1383,49 +1385,65 @@ bool SCCPInstVisitor::isEdgeFeasible(BasicBlock *From, BasicBlock *To) const {
// 7. If a conditional branch has a value that is overdefined, make all
// successors executable.
void SCCPInstVisitor::visitPHINode(PHINode &PN) {
- // If this PN returns a struct, just mark the result overdefined.
- // TODO: We could do a lot better than this if code actually uses this.
- if (PN.getType()->isStructTy())
- return (void)markOverdefined(&PN);
-
- if (getValueState(&PN).isOverdefined())
- return; // Quick exit
-
// Super-extra-high-degree PHI nodes are unlikely to ever be marked constant,
// and slow us down a lot. Just mark them overdefined.
if (PN.getNumIncomingValues() > 64)
return (void)markOverdefined(&PN);
- unsigned NumActiveIncoming = 0;
+ if (isInstUnderDefined(PN))
+ return;
+ std::vector<unsigned> FeasibleIncomingIndices;
----------------
dtcxzyw wrote:
Use SmallVector
https://github.com/llvm/llvm-project/pull/163713
More information about the llvm-commits
mailing list