[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Feb 23 15:48:30 PST 2004


Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.163 -> 1.164

---
Log message:

Generate much more efficient code in programs like pifft


---
Diffs of the changes:  (+8 -0)

Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.163 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.164
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.163	Mon Feb 23 15:46:42 2004
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Mon Feb 23 15:46:58 2004
@@ -2163,6 +2163,14 @@
       // 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);





More information about the llvm-commits mailing list