diff options
author | Chris Lattner <sabre@nondot.org> | 2004-02-23 21:46:58 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-02-23 21:46:58 +0000 |
commit | d8864ce7666a1706c718ce1fb56daec65d81c9da (patch) | |
tree | 2dd1c0a34ebb46f2cbf35cdc875f5098180008f0 /lib/Transforms/Scalar | |
parent | 077a373791ae80867c22468212aa78d9a78b1363 (diff) | |
download | external_llvm-d8864ce7666a1706c718ce1fb56daec65d81c9da.zip external_llvm-d8864ce7666a1706c718ce1fb56daec65d81c9da.tar.gz external_llvm-d8864ce7666a1706c718ce1fb56daec65d81c9da.tar.bz2 |
Generate much more efficient code in programs like pifft
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@11775 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/Scalar')
-rw-r--r-- | lib/Transforms/Scalar/InstructionCombining.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index 0b47163..fb7dc98 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -2163,6 +2163,14 @@ Instruction *InstCombiner::visitGetElementPtrInst(GetElementPtrInst &GEP) { // Replace: gep (gep %P, long B), long A, ... // With: T = long A+B; gep %P, T, ... // + // Note that if our source is a gep chain itself that we wait for that + // chain to be resolved before we perform this transformation. This + // avoids us creating a TON of code in some cases. + // + if (isa<GetElementPtrInst>(Src->getOperand(0)) && + cast<Instruction>(Src->getOperand(0))->getNumOperands() == 2) + return 0; // Wait until our source is folded to completion. + Value *Sum = BinaryOperator::create(Instruction::Add, Src->getOperand(1), GEP.getOperand(1), Src->getName()+".sum", &GEP); |