[llvm-commits] CVS: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h

Chris Lattner sabre at nondot.org
Thu Apr 12 22:04:41 PDT 2007



Changes in directory llvm/include/llvm/Analysis:

ScalarEvolutionExpander.h updated: 1.13 -> 1.14
---
Log message:

CSE simple binary expressions when they are inserted.  This makes LSR produce
less huge code that needs to be cleaned up by sdisel.


---
Diffs of the changes:  (+7 -4)

 ScalarEvolutionExpander.h |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)


Index: llvm/include/llvm/Analysis/ScalarEvolutionExpander.h
diff -u llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.13 llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.14
--- llvm/include/llvm/Analysis/ScalarEvolutionExpander.h:1.13	Sat Jan 20 18:29:25 2007
+++ llvm/include/llvm/Analysis/ScalarEvolutionExpander.h	Fri Apr 13 00:04:18 2007
@@ -89,7 +89,10 @@
     /// we can to share the casts.
     static Value *InsertCastOfTo(Instruction::CastOps opcode, Value *V, 
                                  const Type *Ty);
-    
+    /// InsertBinop - Insert the specified binary operator, doing a small amount
+    /// of work to avoid inserting an obviously redundant operation.
+    static Value *InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
+                              Value *RHS, Instruction *InsertPt);
   protected:
     Value *expand(SCEV *S) {
       // Check to see if we already expanded this.
@@ -141,8 +144,8 @@
 
       // Emit a bunch of add instructions
       for (int i = S->getNumOperands()-2; i >= 0; --i)
-        V = BinaryOperator::createAdd(V, expandInTy(S->getOperand(i), Ty),
-                                      "tmp.", InsertPt);
+        V = InsertBinop(Instruction::Add, V, expandInTy(S->getOperand(i), Ty),
+                        InsertPt);
       return V;
     }
 
@@ -152,7 +155,7 @@
       const Type *Ty = S->getType();
       Value *LHS = expandInTy(S->getLHS(), Ty);
       Value *RHS = expandInTy(S->getRHS(), Ty);
-      return BinaryOperator::createSDiv(LHS, RHS, "tmp.", InsertPt);
+      return InsertBinop(Instruction::SDiv, LHS, RHS, InsertPt);
     }
 
     Value *visitAddRecExpr(SCEVAddRecExpr *S);






More information about the llvm-commits mailing list