[llvm] [GVN] No need to swap if both LHS and RHS are arguments (PR #95566)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 14 09:55:23 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 c7b32341e9f885cc7e6ba4b2ff017f748a6f76ee 1689466ba6034d9e980f3e47c89539f21e50f2b2 -- llvm/lib/Transforms/Scalar/GVN.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp
index fa7be681e3..58508ef323 100644
--- a/llvm/lib/Transforms/Scalar/GVN.cpp
+++ b/llvm/lib/Transforms/Scalar/GVN.cpp
@@ -2472,7 +2472,8 @@ bool GVNPass::propagateEquality(Value *LHS, Value *RHS,
continue;
// Prefer a constant on the right-hand side, or an Argument if no constants.
- if (isa<Constant>(LHS) || (isa<Argument>(LHS) && !isa<Argument>(RHS) && !isa<Constant>(RHS)))
+ if (isa<Constant>(LHS) ||
+ (isa<Argument>(LHS) && !isa<Argument>(RHS) && !isa<Constant>(RHS)))
std::swap(LHS, RHS);
assert((isa<Argument>(LHS) || isa<Instruction>(LHS)) && "Unexpected value!");
const DataLayout &DL =
``````````
</details>
https://github.com/llvm/llvm-project/pull/95566
More information about the llvm-commits
mailing list