summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/Analysis
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Analysis')
-rw-r--r--llvm/unittests/Analysis/AliasAnalysisTest.cpp2
-rw-r--r--llvm/unittests/Analysis/MemorySSATest.cpp54
-rw-r--r--llvm/unittests/Analysis/OrderedInstructionsTest.cpp6
-rw-r--r--llvm/unittests/Analysis/PhiValuesTest.cpp16
-rw-r--r--llvm/unittests/Analysis/ScalarEvolutionTest.cpp6
-rw-r--r--llvm/unittests/Analysis/SparsePropagation.cpp4
6 files changed, 45 insertions, 43 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));
OpenPOWER on IntegriCloud