diff options
Diffstat (limited to 'llvm/lib')
| -rw-r--r-- | llvm/lib/Transforms/InstCombine/InstructionCombining.cpp | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 5af3b67..66bf709 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -1945,39 +1945,6 @@ Instruction *InstCombinerImpl::visitGEPOfGEP(GetElementPtrInst &GEP, if (!shouldMergeGEPs(*cast<GEPOperator>(&GEP), *Src)) return nullptr; - if (Src->getResultElementType() == GEP.getSourceElementType() && - Src->getNumOperands() == 2 && GEP.getNumOperands() == 2 && - Src->hasOneUse()) { - Value *GO1 = GEP.getOperand(1); - Value *SO1 = Src->getOperand(1); - - if (LI) { - // Try to reassociate loop invariant GEP chains to enable LICM. - if (Loop *L = LI->getLoopFor(GEP.getParent())) { - // Reassociate the two GEPs if SO1 is variant in the loop and GO1 is - // invariant: this breaks the dependence between GEPs and allows LICM - // to hoist the invariant part out of the loop. - if (L->isLoopInvariant(GO1) && !L->isLoopInvariant(SO1)) { - // The swapped GEPs are inbounds if both original GEPs are inbounds - // and the sign of the offsets is the same. For simplicity, only - // handle both offsets being non-negative. - bool IsInBounds = Src->isInBounds() && GEP.isInBounds() && - isKnownNonNegative(SO1, DL, 0, &AC, &GEP, &DT) && - isKnownNonNegative(GO1, DL, 0, &AC, &GEP, &DT); - // Put NewSrc at same location as %src. - Builder.SetInsertPoint(cast<Instruction>(Src)); - Value *NewSrc = Builder.CreateGEP(GEP.getSourceElementType(), - Src->getPointerOperand(), GO1, - Src->getName(), IsInBounds); - GetElementPtrInst *NewGEP = GetElementPtrInst::Create( - GEP.getSourceElementType(), NewSrc, {SO1}); - NewGEP->setIsInBounds(IsInBounds); - return NewGEP; - } - } - } - } - // Note that if our source is a gep chain itself then we wait for that // chain to be resolved before we perform this transformation. This // avoids us creating a TON of code in some cases. |
