[PATCH] D74851: [x86] use instruction-level fast-math-flags to drive MachineCombiner

Michael Berg via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 26 09:10:52 PST 2020


mcberg2017 added a comment.

All in all LGTM, will check back in bit to see what others have to say.



================
Comment at: llvm/lib/Target/X86/X86InstrInfo.cpp:7661
+    return Inst.getFlag(MachineInstr::MIFlag::FmReassoc) &&
+           Inst.getFlag(MachineInstr::MIFlag::FmNsz);
   default:
----------------
The reassociate pass uses nsz too, and as a convention this seems fine.


================
Comment at: llvm/lib/Target/X86/X86InstrInfo.cpp:7850
+  // TODO: There should be a helper function for copying only fast-math-flags.
+  uint16_t IntersectedFlags = OldMI1.getFlags() & OldMI2.getFlags();
+  NewMI1.setFlags(IntersectedFlags);
----------------
I like this as for us in the case when we have divergent FMF environments brought together via inlining, this preserves the bounds of expression interfacing, where neither model would incur on the other.  Perhaps we should have a way to zap the int/float flags as a utility so that we can keep contexts separate in MachineInstr.h.


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

https://reviews.llvm.org/D74851





More information about the llvm-commits mailing list