Skip to content

Commit 29d0b60

Browse files
committed
[StructurizeCFG] Use poison instead of undef as placeholder [NFC]
These are used to create branch instructions. The condition is patched later
1 parent 04527f1 commit 29d0b60

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

llvm/lib/Transforms/Scalar/StructurizeCFG.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ class StructurizeCFG {
239239
Type *Boolean;
240240
ConstantInt *BoolTrue;
241241
ConstantInt *BoolFalse;
242-
UndefValue *BoolUndef;
242+
Value *BoolPoison;
243243

244244
Function *Func;
245245
Region *ParentRegion;
@@ -956,7 +956,7 @@ void StructurizeCFG::wireFlow(bool ExitUseAllowed,
956956
BasicBlock *Next = needPostfix(Flow, ExitUseAllowed);
957957

958958
// let it point to entry and next block
959-
BranchInst *Br = BranchInst::Create(Entry, Next, BoolUndef, Flow);
959+
BranchInst *Br = BranchInst::Create(Entry, Next, BoolPoison, Flow);
960960
Br->setDebugLoc(TermDL[Flow]);
961961
Conditions.push_back(Br);
962962
addPhiValues(Flow, Entry);
@@ -997,7 +997,7 @@ void StructurizeCFG::handleLoops(bool ExitUseAllowed,
997997
// Create an extra loop end node
998998
LoopEnd = needPrefix(false);
999999
BasicBlock *Next = needPostfix(LoopEnd, ExitUseAllowed);
1000-
BranchInst *Br = BranchInst::Create(Next, LoopStart, BoolUndef, LoopEnd);
1000+
BranchInst *Br = BranchInst::Create(Next, LoopStart, BoolPoison, LoopEnd);
10011001
Br->setDebugLoc(TermDL[LoopEnd]);
10021002
LoopConds.push_back(Br);
10031003
addPhiValues(LoopEnd, LoopStart);
@@ -1125,7 +1125,7 @@ void StructurizeCFG::init(Region *R) {
11251125
Boolean = Type::getInt1Ty(Context);
11261126
BoolTrue = ConstantInt::getTrue(Context);
11271127
BoolFalse = ConstantInt::getFalse(Context);
1128-
BoolUndef = UndefValue::get(Boolean);
1128+
BoolPoison = PoisonValue::get(Boolean);
11291129

11301130
this->UA = nullptr;
11311131
}

0 commit comments

Comments
 (0)