diff options
author | James Y Knight <jyknight@google.com> | 2019-02-01 20:44:24 +0000 |
---|---|---|
committer | James Y Knight <jyknight@google.com> | 2019-02-01 20:44:24 +0000 |
commit | 14359ef1b6a0610ac91df5f5a91c88a0b51c187c (patch) | |
tree | 53b7628ce6ecba998379d0d19f875bc9dad3b69a /llvm/unittests | |
parent | d9e85a0861b7e9320c34547a2ad7f49c504a9381 (diff) | |
download | bcm5719-llvm-14359ef1b6a0610ac91df5f5a91c88a0b51c187c.tar.gz bcm5719-llvm-14359ef1b6a0610ac91df5f5a91c88a0b51c187c.zip |
[opaque pointer types] Pass value type to LoadInst creation.
This cleans up all LoadInst creation in LLVM to explicitly pass the
value type rather than deriving it from the pointer's element-type.
Differential Revision: https://reviews.llvm.org/D57172
llvm-svn: 352911
Diffstat (limited to 'llvm/unittests')
-rw-r--r-- | llvm/unittests/Analysis/AliasAnalysisTest.cpp | 2 | ||||
-rw-r--r-- | llvm/unittests/Analysis/MemorySSATest.cpp | 54 | ||||
-rw-r--r-- | llvm/unittests/Analysis/OrderedInstructionsTest.cpp | 6 | ||||
-rw-r--r-- | llvm/unittests/Analysis/PhiValuesTest.cpp | 16 | ||||
-rw-r--r-- | llvm/unittests/Analysis/ScalarEvolutionTest.cpp | 6 | ||||
-rw-r--r-- | llvm/unittests/Analysis/SparsePropagation.cpp | 4 | ||||
-rw-r--r-- | llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp | 4 | ||||
-rw-r--r-- | llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp | 2 | ||||
-rw-r--r-- | llvm/unittests/IR/IRBuilderTest.cpp | 8 | ||||
-rw-r--r-- | llvm/unittests/IR/PatternMatch.cpp | 2 | ||||
-rw-r--r-- | llvm/unittests/Linker/LinkModulesTest.cpp | 2 | ||||
-rw-r--r-- | llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp | 11 | ||||
-rw-r--r-- | llvm/unittests/Transforms/Utils/FunctionComparatorTest.cpp | 2 |
13 files changed, 62 insertions, 57 deletions
diff --git a/llvm/unittests/Analysis/AliasAnalysisTest.cpp b/llvm/unittests/Analysis/AliasAnalysisTest.cpp index a1a020f000b..7ebff43369d 100644 --- a/llvm/unittests/Analysis/AliasAnalysisTest.cpp +++ b/llvm/unittests/Analysis/AliasAnalysisTest.cpp @@ -174,7 +174,7 @@ TEST_F(AliasAnalysisTest, getModRefInfo) { auto *Addr = ConstantPointerNull::get(PtrType); auto *Store1 = new StoreInst(Value, Addr, BB); - auto *Load1 = new LoadInst(Addr, "load", BB); + auto *Load1 = new LoadInst(IntType, Addr, "load", BB); auto *Add1 = BinaryOperator::CreateAdd(Value, Value, "add", BB); auto *VAArg1 = new VAArgInst(Addr, PtrType, "vaarg", BB); auto *CmpXChg1 = new AtomicCmpXchgInst( diff --git a/llvm/unittests/Analysis/MemorySSATest.cpp b/llvm/unittests/Analysis/MemorySSATest.cpp index 65896c4ee53..402b2cdf10d 100644 --- a/llvm/unittests/Analysis/MemorySSATest.cpp +++ b/llvm/unittests/Analysis/MemorySSATest.cpp @@ -92,7 +92,7 @@ TEST_F(MemorySSATest, CreateALoad) { MemorySSAUpdater Updater(&MSSA); // Add the load B.SetInsertPoint(Merge); - LoadInst *LoadInst = B.CreateLoad(PointerArg); + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), PointerArg); // MemoryPHI should already exist. MemoryPhi *MP = MSSA.getMemoryAccess(Merge); @@ -138,7 +138,7 @@ TEST_F(MemorySSATest, CreateLoadsAndStoreUpdater) { // Add the load B.SetInsertPoint(Merge, Merge->begin()); - LoadInst *FirstLoad = B.CreateLoad(PointerArg); + LoadInst *FirstLoad = B.CreateLoad(B.getInt8Ty(), PointerArg); // MemoryPHI should not already exist. MemoryPhi *MP = MSSA.getMemoryAccess(Merge); @@ -162,7 +162,7 @@ TEST_F(MemorySSATest, CreateLoadsAndStoreUpdater) { // We don't touch existing loads, so we need to create a new one to get a phi // Add the second load B.SetInsertPoint(Merge, Merge->begin()); - LoadInst *SecondLoad = B.CreateLoad(PointerArg); + LoadInst *SecondLoad = B.CreateLoad(B.getInt8Ty(), PointerArg); // MemoryPHI should not already exist. MP = MSSA.getMemoryAccess(Merge); @@ -228,7 +228,7 @@ TEST_F(MemorySSATest, CreateALoadUpdater) { // Add the load B.SetInsertPoint(Merge, Merge->begin()); - LoadInst *LoadInst = B.CreateLoad(PointerArg); + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), PointerArg); // MemoryPHI should not already exist. MemoryPhi *MP = MSSA.getMemoryAccess(Merge); @@ -262,7 +262,7 @@ TEST_F(MemorySSATest, SinkLoad) { // Load in left block B.SetInsertPoint(Left, Left->begin()); - LoadInst *LoadInst1 = B.CreateLoad(PointerArg); + LoadInst *LoadInst1 = B.CreateLoad(B.getInt8Ty(), PointerArg); // Store in merge block B.SetInsertPoint(Merge, Merge->begin()); B.CreateStore(B.getInt8(16), PointerArg); @@ -310,7 +310,7 @@ TEST_F(MemorySSATest, MoveAStore) { BranchInst::Create(Merge, Left); BranchInst::Create(Merge, Right); B.SetInsertPoint(Merge); - B.CreateLoad(PointerArg); + B.CreateLoad(B.getInt8Ty(), PointerArg); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; MemorySSAUpdater Updater(&MSSA); @@ -346,7 +346,7 @@ TEST_F(MemorySSATest, MoveAStoreUpdater) { BranchInst::Create(Merge, Left); BranchInst::Create(Merge, Right); B.SetInsertPoint(Merge); - auto *MergeLoad = B.CreateLoad(PointerArg); + auto *MergeLoad = B.CreateLoad(B.getInt8Ty(), PointerArg); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; MemorySSAUpdater Updater(&MSSA); @@ -392,7 +392,7 @@ TEST_F(MemorySSATest, MoveAStoreUpdaterMove) { BranchInst::Create(Merge, Left); BranchInst::Create(Merge, Right); B.SetInsertPoint(Merge); - auto *MergeLoad = B.CreateLoad(PointerArg); + auto *MergeLoad = B.CreateLoad(B.getInt8Ty(), PointerArg); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; MemorySSAUpdater Updater(&MSSA); @@ -436,7 +436,7 @@ TEST_F(MemorySSATest, MoveAStoreAllAround) { BranchInst::Create(Merge, Left); BranchInst::Create(Merge, Right); B.SetInsertPoint(Merge); - auto *MergeLoad = B.CreateLoad(PointerArg); + auto *MergeLoad = B.CreateLoad(B.getInt8Ty(), PointerArg); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; MemorySSAUpdater Updater(&MSSA); @@ -490,7 +490,7 @@ TEST_F(MemorySSATest, RemoveAPhi) { BranchInst::Create(Merge, Left); BranchInst::Create(Merge, Right); B.SetInsertPoint(Merge); - LoadInst *LoadInst = B.CreateLoad(PointerArg); + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), PointerArg); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; @@ -535,7 +535,7 @@ TEST_F(MemorySSATest, RemoveMemoryAccess) { BranchInst::Create(Merge, Left); BranchInst::Create(Merge, Right); B.SetInsertPoint(Merge); - LoadInst *LoadInst = B.CreateLoad(PointerArg); + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), PointerArg); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; @@ -631,7 +631,7 @@ TEST_F(MemorySSATest, TestStoreAndLoad) { Type *Int8 = Type::getInt8Ty(C); Value *Alloca = B.CreateAlloca(Int8, ConstantInt::get(Int8, 1), "A"); Instruction *SI = B.CreateStore(ConstantInt::get(Int8, 0), Alloca); - Instruction *LI = B.CreateLoad(Alloca); + Instruction *LI = B.CreateLoad(Int8, Alloca); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; @@ -715,12 +715,12 @@ TEST_F(MemorySSATest, PartialWalkerCacheWithPhis) { B.SetInsertPoint(IfThen); Instruction *FirstStore = B.CreateStore(Zero, AllocA); B.CreateStore(Zero, AllocB); - Instruction *ALoad0 = B.CreateLoad(AllocA, ""); + Instruction *ALoad0 = B.CreateLoad(Int8, AllocA, ""); Instruction *BStore = B.CreateStore(Zero, AllocB); // Due to use optimization/etc. we make a store to A, which is removed after // we build MSSA. This helps keep the test case simple-ish. Instruction *KillStore = B.CreateStore(Zero, AllocA); - Instruction *ALoad = B.CreateLoad(AllocA, ""); + Instruction *ALoad = B.CreateLoad(Int8, AllocA, ""); B.CreateBr(IfEnd); B.SetInsertPoint(IfEnd); @@ -771,7 +771,7 @@ TEST_F(MemorySSATest, WalkerInvariantLoadOpt) { Value *AllocA = B.CreateAlloca(Int8, One, ""); Instruction *Store = B.CreateStore(One, AllocA); - Instruction *Load = B.CreateLoad(AllocA); + Instruction *Load = B.CreateLoad(Int8, AllocA); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; @@ -800,7 +800,7 @@ TEST_F(MemorySSATest, WalkerReopt) { Instruction *SIA = B.CreateStore(ConstantInt::get(Int8, 0), AllocaA); Value *AllocaB = B.CreateAlloca(Int8, ConstantInt::get(Int8, 1), "B"); Instruction *SIB = B.CreateStore(ConstantInt::get(Int8, 0), AllocaB); - Instruction *LIA = B.CreateLoad(AllocaA); + Instruction *LIA = B.CreateLoad(Int8, AllocaA); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; @@ -834,11 +834,11 @@ TEST_F(MemorySSATest, MoveAboveMemoryDef) { StoreInst *StoreA0 = B.CreateStore(ConstantInt::get(Int8, 0), A); StoreInst *StoreB = B.CreateStore(ConstantInt::get(Int8, 0), B_); - LoadInst *LoadB = B.CreateLoad(B_); + LoadInst *LoadB = B.CreateLoad(Int8, B_); StoreInst *StoreA1 = B.CreateStore(ConstantInt::get(Int8, 4), A); StoreInst *StoreC = B.CreateStore(ConstantInt::get(Int8, 4), C); StoreInst *StoreA2 = B.CreateStore(ConstantInt::get(Int8, 4), A); - LoadInst *LoadC = B.CreateLoad(C); + LoadInst *LoadC = B.CreateLoad(Int8, C); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; @@ -902,7 +902,7 @@ TEST_F(MemorySSATest, Irreducible) { MemorySSA &MSSA = *Analyses->MSSA; MemorySSAUpdater Updater(&MSSA); // Create the load memory acccess - LoadInst *LoadInst = B.CreateLoad(FirstArg); + LoadInst *LoadInst = B.CreateLoad(B.getInt8Ty(), FirstArg); MemoryUse *LoadAccess = cast<MemoryUse>(Updater.createMemoryAccessInBB( LoadInst, nullptr, AfterLoopBB, MemorySSA::Beginning)); Updater.insertUse(LoadAccess); @@ -1010,15 +1010,15 @@ TEST_F(MemorySSATest, TestLoadMustAlias) { B.CreateStore(ConstantInt::get(Int8, 1), AllocaB); // Check load from LOE - LoadInst *LA1 = B.CreateLoad(AllocaA, ""); + LoadInst *LA1 = B.CreateLoad(Int8, AllocaA, ""); // Check load alias cached for second load - LoadInst *LA2 = B.CreateLoad(AllocaA, ""); + LoadInst *LA2 = B.CreateLoad(Int8, AllocaA, ""); B.CreateStore(ConstantInt::get(Int8, 1), AllocaA); // Check load from store/def - LoadInst *LA3 = B.CreateLoad(AllocaA, ""); + LoadInst *LA3 = B.CreateLoad(Int8, AllocaA, ""); // Check load alias cached for second load - LoadInst *LA4 = B.CreateLoad(AllocaA, ""); + LoadInst *LA4 = B.CreateLoad(Int8, AllocaA, ""); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; @@ -1103,13 +1103,13 @@ TEST_F(MemorySSATest, TestLoadMayAlias) { Argument *PointerA = &*ArgIt; Argument *PointerB = &*(++ArgIt); B.CreateStore(ConstantInt::get(Int8, 1), PointerB); - LoadInst *LA1 = B.CreateLoad(PointerA, ""); + LoadInst *LA1 = B.CreateLoad(Int8, PointerA, ""); B.CreateStore(ConstantInt::get(Int8, 0), PointerA); - LoadInst *LB1 = B.CreateLoad(PointerB, ""); + LoadInst *LB1 = B.CreateLoad(Int8, PointerB, ""); B.CreateStore(ConstantInt::get(Int8, 0), PointerA); - LoadInst *LA2 = B.CreateLoad(PointerA, ""); + LoadInst *LA2 = B.CreateLoad(Int8, PointerA, ""); B.CreateStore(ConstantInt::get(Int8, 0), PointerB); - LoadInst *LB2 = B.CreateLoad(PointerB, ""); + LoadInst *LB2 = B.CreateLoad(Int8, PointerB, ""); setupAnalyses(); MemorySSA &MSSA = *Analyses->MSSA; diff --git a/llvm/unittests/Analysis/OrderedInstructionsTest.cpp b/llvm/unittests/Analysis/OrderedInstructionsTest.cpp index 58eb0e56e06..473fe7f50fc 100644 --- a/llvm/unittests/Analysis/OrderedInstructionsTest.cpp +++ b/llvm/unittests/Analysis/OrderedInstructionsTest.cpp @@ -44,13 +44,13 @@ TEST(OrderedInstructionsTest, DominanceTest) { BasicBlock *BBX = BasicBlock::Create(Ctx, "bbx", F); B.SetInsertPoint(BBX); Argument *PointerArg = &*F->arg_begin(); - LoadInst *LoadInstX = B.CreateLoad(PointerArg); - LoadInst *LoadInstY = B.CreateLoad(PointerArg); + LoadInst *LoadInstX = B.CreateLoad(B.getInt8Ty(), PointerArg); + LoadInst *LoadInstY = B.CreateLoad(B.getInt8Ty(), PointerArg); // Create BBY with 1 load. BasicBlock *BBY = BasicBlock::Create(Ctx, "bby", F); B.SetInsertPoint(BBY); - LoadInst *LoadInstZ = B.CreateLoad(PointerArg); + LoadInst *LoadInstZ = B.CreateLoad(B.getInt8Ty(), PointerArg); B.CreateRet(LoadInstZ); std::unique_ptr<DominatorTree> DT(new DominatorTree(*F)); OrderedInstructions OI(&*DT); diff --git a/llvm/unittests/Analysis/PhiValuesTest.cpp b/llvm/unittests/Analysis/PhiValuesTest.cpp index 6fd3f6d6654..82c02337ef2 100644 --- a/llvm/unittests/Analysis/PhiValuesTest.cpp +++ b/llvm/unittests/Analysis/PhiValuesTest.cpp @@ -37,10 +37,10 @@ TEST(PhiValuesTest, SimplePhi) { BranchInst::Create(Then, If); BranchInst::Create(Then, Else); - Value *Val1 = new LoadInst(UndefValue::get(I32PtrTy), "val1", Entry); - Value *Val2 = new LoadInst(UndefValue::get(I32PtrTy), "val2", Entry); - Value *Val3 = new LoadInst(UndefValue::get(I32PtrTy), "val3", Entry); - Value *Val4 = new LoadInst(UndefValue::get(I32PtrTy), "val4", Entry); + Value *Val1 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val1", Entry); + Value *Val2 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val2", Entry); + Value *Val3 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val3", Entry); + Value *Val4 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val4", Entry); PHINode *Phi1 = PHINode::Create(I32Ty, 2, "phi1", Then); Phi1->addIncoming(Val1, If); @@ -110,10 +110,10 @@ TEST(PhiValuesTest, DependentPhi) { BranchInst::Create(End, If2); BranchInst::Create(End, Else2); - Value *Val1 = new LoadInst(UndefValue::get(I32PtrTy), "val1", Entry); - Value *Val2 = new LoadInst(UndefValue::get(I32PtrTy), "val2", Entry); - Value *Val3 = new LoadInst(UndefValue::get(I32PtrTy), "val3", Entry); - Value *Val4 = new LoadInst(UndefValue::get(I32PtrTy), "val4", Entry); + Value *Val1 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val1", Entry); + Value *Val2 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val2", Entry); + Value *Val3 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val3", Entry); + Value *Val4 = new LoadInst(I32Ty, UndefValue::get(I32PtrTy), "val4", Entry); PHINode *Phi1 = PHINode::Create(I32Ty, 2, "phi1", Then); Phi1->addIncoming(Val1, If1); diff --git a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp index d39df897ea6..132f70eccfb 100644 --- a/llvm/unittests/Analysis/ScalarEvolutionTest.cpp +++ b/llvm/unittests/Analysis/ScalarEvolutionTest.cpp @@ -407,9 +407,11 @@ TEST_F(ScalarEvolutionsTest, CompareValueComplexity) { const int ValueDepth = 10; for (int i = 0; i < ValueDepth; i++) { - X = new LoadInst(new IntToPtrInst(X, IntPtrPtrTy, "", EntryBB), "", + X = new LoadInst(IntPtrTy, new IntToPtrInst(X, IntPtrPtrTy, "", EntryBB), + "", /*isVolatile*/ false, EntryBB); - Y = new LoadInst(new IntToPtrInst(Y, IntPtrPtrTy, "", EntryBB), "", + Y = new LoadInst(IntPtrTy, new IntToPtrInst(Y, IntPtrPtrTy, "", EntryBB), + "", /*isVolatile*/ false, EntryBB); } diff --git a/llvm/unittests/Analysis/SparsePropagation.cpp b/llvm/unittests/Analysis/SparsePropagation.cpp index 58f059f30a8..bab14a2d055 100644 --- a/llvm/unittests/Analysis/SparsePropagation.cpp +++ b/llvm/unittests/Analysis/SparsePropagation.cpp @@ -381,7 +381,7 @@ TEST_F(SparsePropagationTest, FunctionDefined) { BasicBlock *Else = BasicBlock::Create(Context, "else", F); F->arg_begin()->setName("cond"); Builder.SetInsertPoint(If); - LoadInst *Cond = Builder.CreateLoad(F->arg_begin()); + LoadInst *Cond = Builder.CreateLoad(Type::getInt1Ty(Context), F->arg_begin()); Builder.CreateCondBr(Cond, Then, Else); Builder.SetInsertPoint(Then); Builder.CreateRet(Builder.getInt64(1)); @@ -421,7 +421,7 @@ TEST_F(SparsePropagationTest, FunctionOverDefined) { BasicBlock *Else = BasicBlock::Create(Context, "else", F); F->arg_begin()->setName("cond"); Builder.SetInsertPoint(If); - LoadInst *Cond = Builder.CreateLoad(F->arg_begin()); + LoadInst *Cond = Builder.CreateLoad(Type::getInt1Ty(Context), F->arg_begin()); Builder.CreateCondBr(Cond, Then, Else); Builder.SetInsertPoint(Then); Builder.CreateRet(Builder.getInt64(0)); diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp index eb7a45708ea..710ce6d5266 100644 --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITMultipleModuleTest.cpp @@ -211,10 +211,10 @@ TEST_F(MCJITMultipleModuleTest, two_module_global_variables_case) { GVB = insertGlobalInt32(B.get(), "GVB", initialNum); FA = startFunction(A.get(), FunctionType::get(Builder.getInt32Ty(), {}, false), "FA"); - endFunctionWithRet(FA, Builder.CreateLoad(GVA)); + endFunctionWithRet(FA, Builder.CreateLoad(Builder.getInt32Ty(), GVA)); FB = startFunction(B.get(), FunctionType::get(Builder.getInt32Ty(), {}, false), "FB"); - endFunctionWithRet(FB, Builder.CreateLoad(GVB)); + endFunctionWithRet(FB, Builder.CreateLoad(Builder.getInt32Ty(), GVB)); GVC = insertGlobalInt32(B.get(), "GVC", initialNum); GVC->setLinkage(GlobalValue::InternalLinkage); diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp index ae56882ee5c..14099074598 100644 --- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp +++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITTest.cpp @@ -101,7 +101,7 @@ TEST_F(MCJITTest, return_global) { Function *ReturnGlobal = startFunction(M.get(), FunctionType::get(Builder.getInt32Ty(), {}, false), "ReturnGlobal"); - Value *ReadGlobal = Builder.CreateLoad(GV); + Value *ReadGlobal = Builder.CreateLoad(Builder.getInt32Ty(), GV); endFunctionWithRet(ReturnGlobal, ReadGlobal); createJIT(std::move(M)); diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp index a20e495c873..71edb4bee6b 100644 --- a/llvm/unittests/IR/IRBuilderTest.cpp +++ b/llvm/unittests/IR/IRBuilderTest.cpp @@ -54,7 +54,7 @@ TEST_F(IRBuilderTest, Intrinsics) { CallInst *Call; IntrinsicInst *II; - V = Builder.CreateLoad(GV); + V = Builder.CreateLoad(GV->getValueType(), GV); I = cast<Instruction>(Builder.CreateFAdd(V, V)); I->setHasNoInfs(true); I->setHasNoNaNs(false); @@ -207,7 +207,7 @@ TEST_F(IRBuilderTest, FastMathFlags) { Value *F, *FC; Instruction *FDiv, *FAdd, *FCmp, *FCall; - F = Builder.CreateLoad(GV); + F = Builder.CreateLoad(GV->getValueType(), GV); F = Builder.CreateFAdd(F, F); EXPECT_FALSE(Builder.getFastMathFlags().any()); @@ -394,7 +394,7 @@ TEST_F(IRBuilderTest, WrapFlags) { // Test instructions. GlobalVariable *G = new GlobalVariable(*M, Builder.getInt32Ty(), true, GlobalValue::ExternalLinkage, nullptr); - Value *V = Builder.CreateLoad(G); + Value *V = Builder.CreateLoad(G->getValueType(), G); EXPECT_TRUE( cast<BinaryOperator>(Builder.CreateNSWAdd(V, V))->hasNoSignedWrap()); EXPECT_TRUE( @@ -461,7 +461,7 @@ TEST_F(IRBuilderTest, RAIIHelpersTest) { EXPECT_FALSE(Builder.getFastMathFlags().allowReciprocal()); EXPECT_EQ(FPMathA, Builder.getDefaultFPMathTag()); - Value *F = Builder.CreateLoad(GV); + Value *F = Builder.CreateLoad(GV->getValueType(), GV); { IRBuilder<>::InsertPointGuard Guard(Builder); diff --git a/llvm/unittests/IR/PatternMatch.cpp b/llvm/unittests/IR/PatternMatch.cpp index 57bfee7bf2e..e380fb90ad7 100644 --- a/llvm/unittests/IR/PatternMatch.cpp +++ b/llvm/unittests/IR/PatternMatch.cpp @@ -397,7 +397,7 @@ TEST_F(PatternMatchTest, LoadStoreOps) { // store i32 42, i32* %0 Value *Alloca = IRB.CreateAlloca(IRB.getInt32Ty()); - Value *LoadInst = IRB.CreateLoad(Alloca); + Value *LoadInst = IRB.CreateLoad(IRB.getInt32Ty(), Alloca); Value *FourtyTwo = IRB.getInt32(42); Value *StoreInst = IRB.CreateStore(FourtyTwo, Alloca); Value *MatchLoad, *MatchStoreVal, *MatchStorePointer; diff --git a/llvm/unittests/Linker/LinkModulesTest.cpp b/llvm/unittests/Linker/LinkModulesTest.cpp index c5fee682329..832e50c19ee 100644 --- a/llvm/unittests/Linker/LinkModulesTest.cpp +++ b/llvm/unittests/Linker/LinkModulesTest.cpp @@ -83,7 +83,7 @@ TEST_F(LinkModuleTest, BlockAddress) { GEPIndices.push_back(&*F->arg_begin()); Value *GEP = Builder.CreateGEP(AT, GV, GEPIndices, "switch.gep"); - Value *Load = Builder.CreateLoad(GEP, "switch.load"); + Value *Load = Builder.CreateLoad(AT->getElementType(), GEP, "switch.load"); Builder.CreateRet(Load); diff --git a/llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp b/llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp index d9c08f060a6..5cb8e91cb3f 100644 --- a/llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp +++ b/llvm/unittests/Transforms/Scalar/LoopPassManagerTest.cpp @@ -908,7 +908,8 @@ TEST_F(LoopPassManagerTest, LoopChildInsertion) { ASSERT_THAT(BBI, F.end()); auto CreateCondBr = [&](BasicBlock *TrueBB, BasicBlock *FalseBB, const char *Name, BasicBlock *BB) { - auto *Cond = new LoadInst(&Ptr, Name, /*isVolatile*/ true, BB); + auto *Cond = new LoadInst(Type::getInt1Ty(Context), &Ptr, Name, + /*isVolatile*/ true, BB); BranchInst::Create(TrueBB, FalseBB, Cond, BB); }; @@ -1110,7 +1111,8 @@ TEST_F(LoopPassManagerTest, LoopPeerInsertion) { ASSERT_THAT(BBI, F.end()); auto CreateCondBr = [&](BasicBlock *TrueBB, BasicBlock *FalseBB, const char *Name, BasicBlock *BB) { - auto *Cond = new LoadInst(&Ptr, Name, /*isVolatile*/ true, BB); + auto *Cond = new LoadInst(Type::getInt1Ty(Context), &Ptr, Name, + /*isVolatile*/ true, BB); BranchInst::Create(TrueBB, FalseBB, Cond, BB); }; @@ -1503,8 +1505,9 @@ TEST_F(LoopPassManagerTest, LoopDeletion) { auto *NewLoop03BB = BasicBlock::Create(Context, "loop.0.3", &F, &Loop0LatchBB); BranchInst::Create(NewLoop03BB, NewLoop03PHBB); - auto *Cond = new LoadInst(&Ptr, "cond.0.3", /*isVolatile*/ true, - NewLoop03BB); + auto *Cond = + new LoadInst(Type::getInt1Ty(Context), &Ptr, "cond.0.3", + /*isVolatile*/ true, NewLoop03BB); BranchInst::Create(&Loop0LatchBB, NewLoop03BB, Cond, NewLoop03BB); Loop02PHBB.getTerminator()->replaceUsesOfWith(&Loop0LatchBB, NewLoop03PHBB); diff --git a/llvm/unittests/Transforms/Utils/FunctionComparatorTest.cpp b/llvm/unittests/Transforms/Utils/FunctionComparatorTest.cpp index cf1296206d0..42f9fb39c2d 100644 --- a/llvm/unittests/Transforms/Utils/FunctionComparatorTest.cpp +++ b/llvm/unittests/Transforms/Utils/FunctionComparatorTest.cpp @@ -31,7 +31,7 @@ struct TestFunction { BB = BasicBlock::Create(Ctx, "", F); B.SetInsertPoint(BB); Argument *PointerArg = &*F->arg_begin(); - LoadInst *LoadInst = B.CreateLoad(PointerArg); + LoadInst *LoadInst = B.CreateLoad(T, PointerArg); C = B.getInt8(addVal); I = cast<Instruction>(B.CreateAdd(LoadInst, C)); B.CreateRet(I); |