[PATCH] D26569: [InstCombine] Support load(gep(A, select(idx1, idx2)))) to select(load(gep(A, idx1)), load(gep(A, idx2))) transformation
Wei Mi via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 12 10:16:42 PST 2016
wmi added inline comments.
================
Comment at: lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp:907-908
+ } else {
+ delete NewGEP1;
+ delete NewGEP2;
+ }
----------------
majnemer wrote:
> wmi wrote:
> > majnemer wrote:
> > > Do not create IR if you don't think you will use it.
> > But I only need to insert the nodes into IR after isSafeToLoadUnconditionally return true for them. Any suggestion for this case?
> Something like:
> if (isSafeToLoadUnconditionally(NewGEP1, Align, DL, GEPI) &&
> isSafeToLoadUnconditionally(NewGEP2, Align, DL, GEPI)) {
> GetElementPtrInst *NewGEP1 = cast<GetElementPtrInst>(GEPI->clone());
> GetElementPtrInst *NewGEP2 = cast<GetElementPtrInst>(GEPI->clone());
> NewGEP1->setOperand(LastIdx, SI->getOperand(1));
> NewGEP2->setOperand(LastIdx, SI->getOperand(2));
> ...
But then NewGEP1 will be used in the if condition before it is created.
Repository:
rL LLVM
https://reviews.llvm.org/D26569
More information about the llvm-commits
mailing list