[llvm] [InstCombine] Add helper simplifying Instruction w/ constants with eq/ne Constants (PR #86346)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 14:50: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 bbcfe6f4311af8cf6095a5bc5937fa68a87b4289 f4a845a1a67851566a3e760bdbdaadf535875bd9 -- llvm/include/llvm/Transforms/InstCombine/InstCombiner.h llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index f4a9343476..40437f79e7 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3644,13 +3644,13 @@ InstCombiner::simplifyOpWithConstantEqConsts(Value *Op, BuilderTy &Builder,
// X nuw C0 == C1 -> X == C1 u/ C0 iff C1 u% C0 == 0
if (all_of(ValsAsAPInt,
- [&](const APInt * AC) { return AC->urem(*MC).isZero(); })) {
+ [&](const APInt *AC) { return AC->urem(*MC).isZero(); })) {
ReverseAllAPInt([&](const APInt *Val) { return Val->udiv(*MC); });
return I->getOperand(0);
}
// X nuw C0 == C1 -> X == C1 s/ C0 iff C1 s% C0 == 0
- if (all_of(ValsAsAPInt, [&](const APInt * AC) {
+ if (all_of(ValsAsAPInt, [&](const APInt *AC) {
return (!AC->isMinSignedValue() || !MC->isAllOnes()) &&
AC->srem(*MC).isZero();
})) {
``````````
</details>
https://github.com/llvm/llvm-project/pull/86346
More information about the llvm-commits
mailing list