[PATCH] D26521: [X86] Allow folding of reloads from stack slots when loading a subreg of the spilled reg

Michael Kuperstein via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 10 15:10:31 PST 2016


mkuper added inline comments.


================
Comment at: include/llvm/Target/TargetInstrInfo.h:820-828
+  /// Check whether the target can fold a load that feeds a subreg operand
+  /// (or a subreg operand that feeds a store).
+  /// For stores, LoadMI is always null. For loads, LoadMI is non-null if
+  /// we're trying to fold an existing load instruction, and null if we are
+  /// trying to fold a load
+  virtual bool isSubregFoldable(MachineOperand &MO,
+                                MachineInstr *LoadMI) const {
----------------
MatzeB wrote:
> Shouldn't we better fix the existing foldMemoryOperand() implementations in the targets instead of adding more API? A "fix" in the sense to actually check the SubReg and return nullptr if it is set would be enough.
I'm somewhat wary of changing the default behavior to be more permissive.

It would be very easy to "fix" all the in-tree targets by sinking the SubReg check into their foldMemoryOperandImpl(), but it has the potential of introducing really nasty bugs for downstream out-of-tree targets.


https://reviews.llvm.org/D26521





More information about the llvm-commits mailing list