[llvm] [InstCombine] Prevent infinite loop with two shifts (PR #118806)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 5 05:59:52 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 ff78cd5f3d6ae8e7084f0aff4df4164ff5a38af9 5977d79c6ce41cfc4cbf18764eec8cae1c40f12a --extensions cpp -- llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 3fb094579d..a57fdbebc7 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -786,9 +786,8 @@ Instruction *InstCombinerImpl::FoldShiftByConstant(Value *Op0, Constant *C1,
Constant *C2;
Value *X;
bool IsLeftShift = I.getOpcode() == Instruction::Shl;
- if (match(Op0,
- m_BinOp(I.getOpcode(), m_ImmConstant(C2),
- m_CombineAnd(m_Value(X), m_Unless(m_Constant()))))) {
+ if (match(Op0, m_BinOp(I.getOpcode(), m_ImmConstant(C2),
+ m_CombineAnd(m_Value(X), m_Unless(m_Constant()))))) {
Instruction *R = BinaryOperator::Create(
I.getOpcode(), Builder.CreateBinOp(I.getOpcode(), C2, C1), X);
BinaryOperator *BO0 = cast<BinaryOperator>(Op0);
``````````
</details>
https://github.com/llvm/llvm-project/pull/118806
More information about the llvm-commits
mailing list