[PATCH] D89978: Fix SROA with a PHI mergig values from a same block
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 26 08:35:11 PDT 2020
lebedev.ri added inline comments.
================
Comment at: llvm/lib/Transforms/Scalar/SROA.cpp:3544-3557
SmallVector<Value *, 4> Index(GEPI.idx_begin(), GEPI.idx_end());
bool IsInBounds = GEPI.isInBounds();
IRBuilderTy PHIBuilder(GEPI.getParent()->getFirstNonPHI());
PHINode *NewPN = PHIBuilder.CreatePHI(GEPI.getType(),
PHI->getNumIncomingValues(),
PHI->getName() + ".sroa.phi");
for (unsigned I = 0, E = PHI->getNumIncomingValues(); I != E; ++I) {
----------------
rampitec wrote:
> lebedev.ri wrote:
> > Can't you instead simply cache GEP's, i.e. have a `map<basicblock, NewVal>`,
> > and perform this GEP creation only if there is no previous gep for that incoming bb in the map?
> I thought about it. but it seems to miss the target. It will not help SROA to eliminate an alloca as far as I understand, so there seems to be no reason to do it.
I'm not sure why it would matter to SROA, that sounds like an unrelated bug that should be fixed..
I think it would be more future-proof fix.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D89978/new/
https://reviews.llvm.org/D89978
More information about the llvm-commits
mailing list