forked from OSchip/llvm-project
Fix use of deprecated IRBuilder::CreateLoad in Kaleidoscope
This commit is contained in:
parent
0fd0fb5329
commit
48578ec2c4
|
@ -745,12 +745,12 @@ Value *NumberExprAST::codegen() {
|
|||
|
||||
Value *VariableExprAST::codegen() {
|
||||
// Look this variable up in the function.
|
||||
Value *V = NamedValues[Name];
|
||||
if (!V)
|
||||
AllocaInst *A = NamedValues[Name];
|
||||
if (!A)
|
||||
return LogErrorV("Unknown variable name");
|
||||
|
||||
// Load the value.
|
||||
return Builder->CreateLoad(V, Name.c_str());
|
||||
return Builder->CreateLoad(A->getAllocatedType(), A, Name.c_str());
|
||||
}
|
||||
|
||||
Value *UnaryExprAST::codegen() {
|
||||
|
@ -962,7 +962,8 @@ Value *ForExprAST::codegen() {
|
|||
|
||||
// Reload, increment, and restore the alloca. This handles the case where
|
||||
// the body of the loop mutates the variable.
|
||||
Value *CurVar = Builder->CreateLoad(Alloca, VarName.c_str());
|
||||
Value *CurVar =
|
||||
Builder->CreateLoad(Alloca->getAllocatedType(), Alloca, VarName.c_str());
|
||||
Value *NextVar = Builder->CreateFAdd(CurVar, StepVal, "nextvar");
|
||||
Builder->CreateStore(NextVar, Alloca);
|
||||
|
||||
|
|
Loading…
Reference in New Issue