[PATCH] D89978: Fix SROA with a constant value PHI
Eli Friedman via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 22 17:19:14 PDT 2020
efriedma added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/SROA.cpp:3527
PHINode *PHI = cast<PHINode>(GEPI.getPointerOperand());
- if (GEPI.getParent() != PHI->getParent() ||
+ if (GEPI.getParent() != PHI->getParent() || PHI->hasConstantValue() ||
llvm::any_of(PHI->incoming_values(), [](Value *In)
----------------
rampitec wrote:
> efriedma wrote:
> > I don't think that's what you want to check. In particular, it doesn't handle the case where a block has multiple predecessors containing a construct like `br i1 undef, label %cond.end.i, label %cond.end.i` (or more commonly, a switch).
> Do you mean it is legal to have several incoming values from a same block and then some from another?
Yes. For example, https://godbolt.org/z/6b86Ts .
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89978/new/
https://reviews.llvm.org/D89978
More information about the llvm-commits
mailing list