[llvm] [SimplifyCFG] Simplify conditional branches on const icmp eq's (PR #73334)

via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 24 06:46:45 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 820b3583c9681a1969814ac3b04a6fe41b87d079 b2af341f9e5bcb8c297595051e82437c572155c9 -- llvm/lib/Transforms/Utils/SimplifyCFG.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 2fe0c28166..37dde745ba 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -3578,7 +3578,8 @@ static bool FoldTwoEntryPHINode(PHINode *PN, const TargetTransformInfo &TTI,
   return true;
 }
 
-static BranchInst *decayCondBranchToUncondBranch(IRBuilderBase &Builder, BranchInst *BI, bool Eval) {
+static BranchInst *decayCondBranchToUncondBranch(IRBuilderBase &Builder,
+                                                 BranchInst *BI, bool Eval) {
   unsigned SuccessorIdx = (Eval) ? 0 : 1;
   auto *NewBI = Builder.CreateBr(BI->getSuccessor(SuccessorIdx));
   BI->eraseFromParent();
@@ -7332,8 +7333,9 @@ bool SimplifyCFGOpt::simplifyCondBranch(BranchInst *BI, IRBuilder<> &Builder) {
           if (mergeConditionalStores(PBI, BI, DTU, DL, TTI))
             return requestResimplify();
 
-  // Check if the condition is an equality between two constants. This can form due to other
-  // CFGSimplify steps, and may prevent further simplification if we don't deal with it here.
+  // Check if the condition is an equality between two constants. This can form
+  // due to other CFGSimplify steps, and may prevent further simplification if
+  // we don't deal with it here.
   if (auto ICmp = dyn_cast<ICmpInst>(BI->getCondition()))
     if (ICmp->getPredicate() == CmpInst::ICMP_EQ)
       if (auto *LHS = dyn_cast<ConstantInt>(ICmp->getOperand(0)))

``````````

</details>


https://github.com/llvm/llvm-project/pull/73334


More information about the llvm-commits mailing list