[llvm] [InstCombine] Fold adds + shifts with nsw and nuw flags (PR #88193)

via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 07:22:22 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 efce8a05aa4ef0353e73e63d270a22773e090e75 3ccd398d661d853f6b74b9f320c50782dde1a1fc -- 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 0fde03899c..7f766ab0e2 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -1266,7 +1266,8 @@ Instruction *InstCombinerImpl::visitLShr(BinaryOperator &I) {
                                      m_Value(Y))))) {
     Value *NewLshr = Builder.CreateLShr(Y, Op1, "", I.isExact());
     auto *NewAdd = BinaryOperator::CreateNUWAdd(NewLshr, X);
-      newAdd->setHasNoSignedWrap(cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap());
+    newAdd->setHasNoSignedWrap(
+        cast<OverflowingBinaryOperator>(Op0)->hasNoSignedWrap());
     return newAdd;
   }
 

``````````

</details>


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


More information about the llvm-commits mailing list