[llvm] [InstCombine] Fix the correctness of missing check reassoc attribute (PR #71277)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 14 20:50:14 PST 2023


================
@@ -321,6 +321,27 @@ void Instruction::setNonNeg(bool b) {
                          (b * PossiblyNonNegInst::NonNeg);
 }
 
+bool Instruction::hasAllowReassocOfAllOperand() const {
+  return all_of(operands(), [](Value *V) {
+    if (!isa<FPMathOperator>(V))
+      return true;
+
+    auto *FPOp = cast<FPMathOperator>(V);
+    switch (FPOp->getOpcode()) {
+    case Instruction::FNeg:
----------------
arsenm wrote:

Don't really need the opcode checks?

https://github.com/llvm/llvm-project/pull/71277


More information about the llvm-commits mailing list