diff --git a/llvm/examples/BrainF/BrainF.cpp b/llvm/examples/BrainF/BrainF.cpp index 067dad137658..ba9184df72ad 100644 --- a/llvm/examples/BrainF/BrainF.cpp +++ b/llvm/examples/BrainF/BrainF.cpp @@ -223,7 +223,8 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb, case SYM_WRITE: { //%tape.%d = load i8 *%head.%d - LoadInst *tape_0 = builder->CreateLoad(curhead, tapereg); + LoadInst *tape_0 = + builder->CreateLoad(IntegerType::getInt8Ty(C), curhead, tapereg); //%tape.%d = sext i8 %tape.%d to i32 Value *tape_1 = builder-> @@ -275,7 +276,8 @@ void BrainF::readloop(PHINode *phi, BasicBlock *oldbb, BasicBlock *testbb, case SYM_CHANGE: { //%tape.%d = load i8 *%head.%d - LoadInst *tape_0 = builder->CreateLoad(curhead, tapereg); + LoadInst *tape_0 = + builder->CreateLoad(IntegerType::getInt8Ty(C), curhead, tapereg); //%tape.%d = add i8 %tape.%d, %d Value *tape_1 = builder-> diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp index 2a405aebf3f1..440d1b8dbd71 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter1/toy.cpp @@ -744,7 +744,7 @@ Value *VariableExprAST::codegen() { return LogErrorV("Unknown variable name"); // Load the value. - return Builder->CreateLoad(V, Name.c_str()); + return Builder->CreateLoad(Type::getDoubleTy(*TheContext), V, Name.c_str()); } Value *UnaryExprAST::codegen() { @@ -956,7 +956,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(Type::getDoubleTy(*TheContext), Alloca, + VarName.c_str()); Value *NextVar = Builder->CreateFAdd(CurVar, StepVal, "nextvar"); Builder->CreateStore(NextVar, Alloca); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp index 2a405aebf3f1..440d1b8dbd71 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter2/toy.cpp @@ -744,7 +744,7 @@ Value *VariableExprAST::codegen() { return LogErrorV("Unknown variable name"); // Load the value. - return Builder->CreateLoad(V, Name.c_str()); + return Builder->CreateLoad(Type::getDoubleTy(*TheContext), V, Name.c_str()); } Value *UnaryExprAST::codegen() { @@ -956,7 +956,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(Type::getDoubleTy(*TheContext), Alloca, + VarName.c_str()); Value *NextVar = Builder->CreateFAdd(CurVar, StepVal, "nextvar"); Builder->CreateStore(NextVar, Alloca); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp index 2a405aebf3f1..440d1b8dbd71 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter3/toy.cpp @@ -744,7 +744,7 @@ Value *VariableExprAST::codegen() { return LogErrorV("Unknown variable name"); // Load the value. - return Builder->CreateLoad(V, Name.c_str()); + return Builder->CreateLoad(Type::getDoubleTy(*TheContext), V, Name.c_str()); } Value *UnaryExprAST::codegen() { @@ -956,7 +956,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(Type::getDoubleTy(*TheContext), Alloca, + VarName.c_str()); Value *NextVar = Builder->CreateFAdd(CurVar, StepVal, "nextvar"); Builder->CreateStore(NextVar, Alloca); diff --git a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp index dc6d9da87c7e..7a51e33b2cdf 100644 --- a/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp +++ b/llvm/examples/Kaleidoscope/BuildingAJIT/Chapter4/toy.cpp @@ -727,7 +727,7 @@ Value *VariableExprAST::codegen() { return LogErrorV("Unknown variable name"); // Load the value. - return Builder->CreateLoad(V, Name.c_str()); + return Builder->CreateLoad(Type::getDoubleTy(*TheContext), V, Name.c_str()); } Value *UnaryExprAST::codegen() { @@ -939,7 +939,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(Type::getDoubleTy(*TheContext), Alloca, + VarName.c_str()); Value *NextVar = Builder->CreateFAdd(CurVar, StepVal, "nextvar"); Builder->CreateStore(NextVar, Alloca); diff --git a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp index a1fe89a9f844..fca54f2b976a 100644 --- a/llvm/examples/Kaleidoscope/Chapter8/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter8/toy.cpp @@ -749,7 +749,7 @@ Value *VariableExprAST::codegen() { return LogErrorV("Unknown variable name"); // Load the value. - return Builder->CreateLoad(V, Name.c_str()); + return Builder->CreateLoad(Type::getDoubleTy(*TheContext), V, Name.c_str()); } Value *UnaryExprAST::codegen() { @@ -961,7 +961,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(Type::getDoubleTy(*TheContext), Alloca, + VarName.c_str()); Value *NextVar = Builder->CreateFAdd(CurVar, StepVal, "nextvar"); Builder->CreateStore(NextVar, Alloca); diff --git a/llvm/examples/Kaleidoscope/Chapter9/toy.cpp b/llvm/examples/Kaleidoscope/Chapter9/toy.cpp index e23d14448499..2fcbebaf1dd3 100644 --- a/llvm/examples/Kaleidoscope/Chapter9/toy.cpp +++ b/llvm/examples/Kaleidoscope/Chapter9/toy.cpp @@ -911,7 +911,7 @@ Value *VariableExprAST::codegen() { KSDbgInfo.emitLocation(this); // Load the value. - return Builder->CreateLoad(V, Name.c_str()); + return Builder->CreateLoad(Type::getDoubleTy(*TheContext), V, Name.c_str()); } Value *UnaryExprAST::codegen() { @@ -1132,7 +1132,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(Type::getDoubleTy(*TheContext), Alloca, + VarName.c_str()); Value *NextVar = Builder->CreateFAdd(CurVar, StepVal, "nextvar"); Builder->CreateStore(NextVar, Alloca);