Skip to content

Commit 91e134a

Browse files
authored
[llvm] Replace UndefValue::get with PoisonValue::get in a unit test [NFC] (#115985)
Since these `UndefValue::get` are acted as placeholders, I think it's safe to replace them with poison values. There are a lot of `UndefValue::get` in LLVM, I'll start fixing the ones in `unittests` while fixing the regression tests.
1 parent ae7b5af commit 91e134a

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

llvm/unittests/Analysis/PhiValuesTest.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ TEST(PhiValuesTest, SimplePhi) {
3434
BasicBlock *If = BasicBlock::Create(C, "if", F);
3535
BasicBlock *Else = BasicBlock::Create(C, "else", F);
3636
BasicBlock *Then = BasicBlock::Create(C, "then", F);
37-
BranchInst::Create(If, Else, UndefValue::get(I1Ty), Entry);
37+
BranchInst::Create(If, Else, PoisonValue::get(I1Ty), Entry);
3838
BranchInst::Create(Then, If);
3939
BranchInst::Create(Then, Else);
4040

41-
Value *Val1 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val1", Entry);
42-
Value *Val2 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val2", Entry);
43-
Value *Val3 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val3", Entry);
44-
Value *Val4 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val4", Entry);
41+
Value *Val1 = new LoadInst(I32Ty, PoisonValue::get(PtrTy), "val1", Entry);
42+
Value *Val2 = new LoadInst(I32Ty, PoisonValue::get(PtrTy), "val2", Entry);
43+
Value *Val3 = new LoadInst(I32Ty, PoisonValue::get(PtrTy), "val3", Entry);
44+
Value *Val4 = new LoadInst(I32Ty, PoisonValue::get(PtrTy), "val4", Entry);
4545

4646
PHINode *Phi1 = PHINode::Create(I32Ty, 2, "phi1", Then);
4747
Phi1->addIncoming(Val1, If);
@@ -104,17 +104,17 @@ TEST(PhiValuesTest, DependentPhi) {
104104
BasicBlock *If2 = BasicBlock::Create(C, "if2", F);
105105
BasicBlock *Else2 = BasicBlock::Create(C, "else2", F);
106106
BasicBlock *End = BasicBlock::Create(C, "then", F);
107-
BranchInst::Create(If1, Else1, UndefValue::get(I1Ty), Entry);
107+
BranchInst::Create(If1, Else1, PoisonValue::get(I1Ty), Entry);
108108
BranchInst::Create(Then, If1);
109109
BranchInst::Create(Then, Else1);
110-
BranchInst::Create(If2, Else2, UndefValue::get(I1Ty), Then);
110+
BranchInst::Create(If2, Else2, PoisonValue::get(I1Ty), Then);
111111
BranchInst::Create(End, If2);
112112
BranchInst::Create(End, Else2);
113113

114-
Value *Val1 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val1", Entry);
115-
Value *Val2 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val2", Entry);
116-
Value *Val3 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val3", Entry);
117-
Value *Val4 = new LoadInst(I32Ty, UndefValue::get(PtrTy), "val4", Entry);
114+
Value *Val1 = new LoadInst(I32Ty, PoisonValue::get(PtrTy), "val1", Entry);
115+
Value *Val2 = new LoadInst(I32Ty, PoisonValue::get(PtrTy), "val2", Entry);
116+
Value *Val3 = new LoadInst(I32Ty, PoisonValue::get(PtrTy), "val3", Entry);
117+
Value *Val4 = new LoadInst(I32Ty, PoisonValue::get(PtrTy), "val4", Entry);
118118

119119
PHINode *Phi1 = PHINode::Create(I32Ty, 2, "phi1", Then);
120120
Phi1->addIncoming(Val1, If1);

0 commit comments

Comments
 (0)