[llvm] Min and Max are associative (PR #171268)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 8 23:05:27 PST 2025
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 origin/main HEAD --extensions h -- llvm/include/llvm/IR/Instruction.h --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index b37b07d15..4605ba49f 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -746,13 +746,13 @@ public:
///
/// Associative operators satisfy: x op (y op z) === (x op y) op z
///
- /// In LLVM, the Add, Mul, And, Or, Xor, Min and Max operators are associative.
+ /// In LLVM, the Add, Mul, And, Or, Xor, Min and Max operators are
+ /// associative.
///
LLVM_ABI bool isAssociative() const LLVM_READONLY;
static bool isAssociative(unsigned Opcode) {
- return Opcode == And || Opcode == Or || Opcode == Xor ||
- Opcode == Add || Opcode == Mul || Opcode == Min ||
- Opcode == Max;
+ return Opcode == And || Opcode == Or || Opcode == Xor || Opcode == Add ||
+ Opcode == Mul || Opcode == Min || Opcode == Max;
}
/// Return true if the instruction is commutative:
``````````
</details>
https://github.com/llvm/llvm-project/pull/171268
More information about the llvm-commits
mailing list