[llvm] LICM: hoist BO assoc when BinOp is in RHS (PR #107072)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 4 05:25:36 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 55a24738302eb9bb5bf458220deb20ddef60ce51 d7f2c17251755fbb306505077f18925fa20cb6c5 --extensions cpp -- llvm/lib/Transforms/Scalar/LICM.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp
index f10dbcf5f8..ecb65be160 100644
--- a/llvm/lib/Transforms/Scalar/LICM.cpp
+++ b/llvm/lib/Transforms/Scalar/LICM.cpp
@@ -2840,7 +2840,7 @@ static bool hoistBOAssociation(Instruction &I, Loop &L,
assert(BO0->isCommutative() && "Associativity implies commutativity");
} else if (L.isLoopInvariant(LV) && !L.isLoopInvariant(C1)) {
if (!BinOpInRHS)
- assert(BO0->isCommutative() && "Associativity implies commutativity");
+ assert(BO0->isCommutative() && "Associativity implies commutativity");
std::swap(LV, C1);
} else {
return false;
@@ -2859,9 +2859,9 @@ static bool hoistBOAssociation(Instruction &I, Loop &L,
auto *NewBO =
BinOpInRHS
? BinaryOperator::Create(Opcode, Inv, LV, BO->getName() + ".reass",
- BO->getIterator())
+ BO->getIterator())
: BinaryOperator::Create(Opcode, LV, Inv, BO->getName() + ".reass",
- BO->getIterator());
+ BO->getIterator());
// Copy NUW for ADDs if both instructions have it.
if (Opcode == Instruction::Add && BO->hasNoUnsignedWrap() &&
``````````
</details>
https://github.com/llvm/llvm-project/pull/107072
More information about the llvm-commits
mailing list