<p>In this case, the LHS and RHS of the multiplication are the same value. We'd
really like to see this generate "<tt>tmp = x+3; result = tmp*tmp;</tt>" instead
-of computing "<tt>x*3</tt>" twice.</p>
+of computing "<tt>x+3</tt>" twice.</p>
<p>Unfortunately, no amount of local analysis will be able to detect and correct
this. This requires two transformations: reassociation of expressions (to
if (CurTok == ')') break;
if (CurTok != ',')
- return Error("Expected ')'");
+ return Error("Expected ')' or ',' in argument list");
getNextToken();
}
}
std::vector<const Type*> Doubles(Args.size(), Type::DoubleTy);
FunctionType *FT = FunctionType::get(Type::DoubleTy, Doubles, false);
- Function *F = new Function(FT, Function::ExternalLinkage, Name, TheModule);
+ Function *F = Function::Create(FT, Function::ExternalLinkage, Name, TheModule);
// If F conflicted, there was already something named 'Name'. If it has a
// body, don't allow redefinition or reextern.
return 0;
// Create a new basic block to start insertion into.
- BasicBlock *BB = new BasicBlock("entry", TheFunction);
+ BasicBlock *BB = BasicBlock::Create("entry", TheFunction);
Builder.SetInsertPoint(BB);
if (Value *RetVal = Body->Codegen()) {