[llvm] Min and Max are associative (PR #82621)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 22 05:59:24 PST 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-ir
Author: None (natanelh-mobileye)
<details>
<summary>Changes</summary>
Min and Max are associative
---
Full diff: https://github.com/llvm/llvm-project/pull/82621.diff
1 Files Affected:
- (modified) llvm/include/llvm/IR/Instruction.h (+3-2)
``````````diff
diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h
index c0e159a342d5b5..1b71448fce3f8e 100644
--- a/llvm/include/llvm/IR/Instruction.h
+++ b/llvm/include/llvm/IR/Instruction.h
@@ -668,12 +668,13 @@ class Instruction : public User,
///
/// Associative operators satisfy: x op (y op z) === (x op y) op z
///
- /// In LLVM, the Add, Mul, And, Or, and Xor operators are associative.
+ /// In LLVM, the Add, Mul, And, Or, Xor, Min and Max operators are associative.
///
bool isAssociative() const LLVM_READONLY;
static bool isAssociative(unsigned Opcode) {
return Opcode == And || Opcode == Or || Opcode == Xor ||
- Opcode == Add || Opcode == Mul;
+ Opcode == Add || Opcode == Mul || Opcode == Min ||
+ Opcode == Max;
}
/// Return true if the instruction is commutative:
``````````
</details>
https://github.com/llvm/llvm-project/pull/82621
More information about the llvm-commits
mailing list