[llvm] [InstCombine] InstCombine should fold frexp of select to select of frexp (PR #121227)

via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 27 12:18:20 PST 2024


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 ac8bb7353a7fe79cd99b3c041d5a153517c31abc 81bafc6b1cdf41dda64454ca856b8b667079f1f4 --extensions cpp -- llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
index a6539e119d..9bcf70c412 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -3837,7 +3837,7 @@ static Instruction *foldFrexpOfSelect(ExtractValueInst *EV, CallInst *FrexpCall,
 
   CallInst *NewFrexp =
       Builder.CreateCall(FrexpCall->getCalledFunction(), {VarOp}, "frexp");
-  Value  *NewEV = Builder.CreateExtractValue(NewFrexp, 0);
+  Value *NewEV = Builder.CreateExtractValue(NewFrexp, 0);
 
   APFloat ConstVal = ConstOp->getValueAPF();
   int Exp;
@@ -3875,10 +3875,10 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
               EV->getNumIndices() == 1 && EV->getIndices()[0] == 0) {
             Value *SelectOp = FrexpCall->getArgOperand(0);
             if (auto *SelInst = dyn_cast<SelectInst>(SelectOp)) {
-                                if (isa<ConstantFP>(SelInst->getTrueValue()) ||
-						isa<ConstantFP>(SelInst->getFalseValue())) {
+              if (isa<ConstantFP>(SelInst->getTrueValue()) ||
+                  isa<ConstantFP>(SelInst->getFalseValue())) {
                 return foldFrexpOfSelect(EV, FrexpCall, SelInst);
-				}
+              }
             }
           }
         }

``````````

</details>


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


More information about the llvm-commits mailing list