[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:49:36 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);
----------------
arsenm wrote:

dyn_cast instead of isa+cast 

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


More information about the llvm-commits mailing list