[PATCH] D138302: [MachineCombiner][RISCV] Make hasReassociableSibling virtual and override it for RISCV

Anton Sidorenko via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 04:16:11 PST 2022


asi-sc added inline comments.


================
Comment at: llvm/lib/Target/RISCV/RISCVInstrInfo.cpp:1211
 
-  if (!Root.getFlag(MachineInstr::MIFlag::FmReassoc) ||
-      !Root.getFlag(MachineInstr::MIFlag::FmNsz) ||
-      !MI->getFlag(MachineInstr::MIFlag::FmReassoc) ||
-      !MI->getFlag(MachineInstr::MIFlag::FmNsz))
-    return false;
+  return RISCV::hasEqualFRM(Inst, Sibling);
+}
----------------
craig.topper wrote:
> asi-sc wrote:
> > Currently, `hasEqualFRM` returns `false` even if both instructions don't have FRM at all. So, to add integer instructions reassociation we:
> >   1. Can check that `Inst` and `Sibling` are floating-point instructions and check FRM equality only in this case 
> >   Or
> >   2. return `true` from `hasEqualFRM` if both instructions do not have FRM operand.
> > 
> > I'd like to ask reviewers which way is better to follow? I'd prefer the second option. 
> > 
> > The question is not about this review, but I'm trying to think a few steps ahead.
> Right now `hasEqualFRM` returns false if either instruction doesn't have an FRM operand. Does that false case ever happen? Sounds like your option 2 here would need that to return `true` if the FRM operand isn't present.
I spent some time thinking about this and changed my opinion. Actually, checking floating-point rounding modes of integer instructions is a strange idea. So, I'll keep the existing behavior.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D138302/new/

https://reviews.llvm.org/D138302



More information about the llvm-commits mailing list