1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 10:32:48 +02:00

Fix use of deprecated IRBuilder::CreateLoad in Kaleidoscope

This commit is contained in:
David Blaikie 2021-03-11 15:42:54 -08:00
parent 648fd413ce
commit 964aca873b

View File

@ -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);