Merge significant portions of the DomTree and PostDomTree implementations.
[oota-llvm.git] / lib / Analysis / ScalarEvolutionExpander.cpp
index 3e590d68f55eadebe090935570f560dd9b5649ba..fc52fb70ff7baa90e450ce1a555aea80c60c322b 100644 (file)
@@ -94,7 +94,7 @@ Value *SCEVExpander::InsertBinop(Instruction::BinaryOps Opcode, Value *LHS,
   }
 
   // If we don't have 
-  return BinaryOperator::create(Opcode, LHS, RHS, "tmp.", InsertPt);
+  return BinaryOperator::create(Opcode, LHS, RHS, "tmp", InsertPt);
 }
 
 Value *SCEVExpander::visitMulExpr(SCEVMulExpr *S) {
@@ -207,3 +207,15 @@ Value *SCEVExpander::visitAddRecExpr(SCEVAddRecExpr *S) {
 
   return expand(V);
 }
+
+Value *SCEVExpander::expand(SCEV *S) {
+  // Check to see if we already expanded this.
+  std::map<SCEVHandle, Value*>::iterator I = InsertedExpressions.find(S);
+  if (I != InsertedExpressions.end())
+    return I->second;
+  
+  Value *V = visit(S);
+  InsertedExpressions[S] = V;
+  return V;
+}
+