[llvm] [InstCombine] Missed optimization for select a%2==0, (a/2*2)*(a/2*2), 0 (PR #92658)

via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 3 10:51:33 PDT 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 59476c99983d3813b412c9b0c0464365644c23a8 70241c0ef98c24fe358c4f9d59614ee46feda4cf --extensions cpp,h -- llvm/include/llvm/Analysis/ValueTracking.h llvm/include/llvm/Transforms/InstCombine/InstCombiner.h llvm/lib/Analysis/ValueTracking.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 4ce1ed00bd..eaa8faaa2d 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineSelect.cpp
@@ -1082,7 +1082,7 @@ static Value *foldAbsDiff(ICmpInst *Cmp, Value *TVal, Value *FVal,
 /// if all bits that are zero in the negated constant
 /// are also zero in A's known zero bits.
 static Value *foldAndMaskPattern(Value *V, Value *Cmp, SelectInst &SI,
-                                     InstCombinerImpl &IC, unsigned Depth = 0) {
+                                 InstCombinerImpl &IC, unsigned Depth = 0) {
 
   Value *A;
   const APInt *MaskedConstant;
@@ -4166,8 +4166,8 @@ Instruction *InstCombinerImpl::visitSelectInst(SelectInst &SI) {
     }
   }
 
-  // Attempts to recursively identify and fold (AND A constant) --> A 
-  // in the true branch of the select if all bits 
+  // Attempts to recursively identify and fold (AND A constant) --> A
+  // in the true branch of the select if all bits
   // that are zero in the negated constant are also zero in A's known zero bits.
   if (TrueVal->hasOneUse())
     if (Value *newTrueOp = foldAndMaskPattern(TrueVal, CondVal, SI, *this))

``````````

</details>


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


More information about the llvm-commits mailing list