[llvm] 707ad01 - [SimplifyCFG] Common code sinking: fixup variable name

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 28 15:24:26 PDT 2021


Author: Roman Lebedev
Date: 2021-04-29T01:24:16+03:00
New Revision: 707ad0139988a1782e63bc1331785b459f30baf5

URL: https://github.com/llvm/llvm-project/commit/707ad0139988a1782e63bc1331785b459f30baf5
DIFF: https://github.com/llvm/llvm-project/commit/707ad0139988a1782e63bc1331785b459f30baf5.diff

LOG: [SimplifyCFG] Common code sinking: fixup variable name

As noticed in post-commit review.

I've gone through several iterations of that name,
and somehow managed to end up with an incorrect one.

Added: 
    

Modified: 
    llvm/lib/Transforms/Utils/SimplifyCFG.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 0704c5f2321a..2369935236a6 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1988,13 +1988,13 @@ static bool SinkCommonCodeFromPredecessors(BasicBlock *BB,
   //         [ end ]
   //
   SmallVector<BasicBlock*,4> UnconditionalPreds;
-  bool AllPredsAreUnconditional = false;
+  bool HaveNonUnconditionalPredecessors = false;
   for (auto *PredBB : predecessors(BB)) {
     auto *PredBr = dyn_cast<BranchInst>(PredBB->getTerminator());
     if (PredBr && PredBr->isUnconditional())
       UnconditionalPreds.push_back(PredBB);
     else
-      AllPredsAreUnconditional = true;
+      HaveNonUnconditionalPredecessors = true;
   }
   if (UnconditionalPreds.size() < 2)
     return false;
@@ -2061,7 +2061,7 @@ static bool SinkCommonCodeFromPredecessors(BasicBlock *BB,
 
   bool Changed = false;
 
-  if (AllPredsAreUnconditional) {
+  if (HaveNonUnconditionalPredecessors) {
     // It is always legal to sink common instructions from unconditional
     // predecessors. However, if not all predecessors are unconditional,
     // this transformation might be pessimizing. So as a rule of thumb,


        


More information about the llvm-commits mailing list