[llvm] 29d0b60 - [StructurizeCFG] Use poison instead of undef as placeholder [NFC]

Nuno Lopes via llvm-commits llvm-commits at lists.llvm.org
Sat Jul 22 05:58:51 PDT 2023


Author: Nuno Lopes
Date: 2023-07-22T13:23:39+01:00
New Revision: 29d0b6043034d1fd70330cebed20b557a26a0b98

URL: https://github.com/llvm/llvm-project/commit/29d0b6043034d1fd70330cebed20b557a26a0b98
DIFF: https://github.com/llvm/llvm-project/commit/29d0b6043034d1fd70330cebed20b557a26a0b98.diff

LOG: [StructurizeCFG] Use poison instead of undef as placeholder [NFC]
These are used to create branch instructions. The condition is patched later

Added: 
    

Modified: 
    llvm/lib/Transforms/Scalar/StructurizeCFG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
index a7609f0b600696..fac5695c7beaf1 100644
--- a/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
+++ b/llvm/lib/Transforms/Scalar/StructurizeCFG.cpp
@@ -239,7 +239,7 @@ class StructurizeCFG {
   Type *Boolean;
   ConstantInt *BoolTrue;
   ConstantInt *BoolFalse;
-  UndefValue *BoolUndef;
+  Value *BoolPoison;
 
   Function *Func;
   Region *ParentRegion;
@@ -956,7 +956,7 @@ void StructurizeCFG::wireFlow(bool ExitUseAllowed,
     BasicBlock *Next = needPostfix(Flow, ExitUseAllowed);
 
     // let it point to entry and next block
-    BranchInst *Br = BranchInst::Create(Entry, Next, BoolUndef, Flow);
+    BranchInst *Br = BranchInst::Create(Entry, Next, BoolPoison, Flow);
     Br->setDebugLoc(TermDL[Flow]);
     Conditions.push_back(Br);
     addPhiValues(Flow, Entry);
@@ -997,7 +997,7 @@ void StructurizeCFG::handleLoops(bool ExitUseAllowed,
   // Create an extra loop end node
   LoopEnd = needPrefix(false);
   BasicBlock *Next = needPostfix(LoopEnd, ExitUseAllowed);
-  BranchInst *Br = BranchInst::Create(Next, LoopStart, BoolUndef, LoopEnd);
+  BranchInst *Br = BranchInst::Create(Next, LoopStart, BoolPoison, LoopEnd);
   Br->setDebugLoc(TermDL[LoopEnd]);
   LoopConds.push_back(Br);
   addPhiValues(LoopEnd, LoopStart);
@@ -1125,7 +1125,7 @@ void StructurizeCFG::init(Region *R) {
   Boolean = Type::getInt1Ty(Context);
   BoolTrue = ConstantInt::getTrue(Context);
   BoolFalse = ConstantInt::getFalse(Context);
-  BoolUndef = UndefValue::get(Boolean);
+  BoolPoison = PoisonValue::get(Boolean);
 
   this->UA = nullptr;
 }


        


More information about the llvm-commits mailing list