[PATCH] D45576: [RFC] Allow target to handle STRICT floating-point nodes

Ulrich Weigand via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 10:43:32 PDT 2018


uweigand added a comment.

In https://reviews.llvm.org/D45576#1109818, @hfinkel wrote:

> To take a hint from the suggestion you relayed from Chris, how about we just add MMOs to these instructions, and then let mayLoad/mayStore look at optional MMOs when returning their answer? Maybe this lets us do what we want without duplicating all of the patterns?


So I was indeed able to change mayLoad and mayStore to allow optional MMOs as you suggested.  (Not part of this patch, but I can post it separately if you're interested.)

Initially I thought that this would allow recognizing strict and non-strict operations without duplicating patterns, using an approach along the lines of the new patch attached here.  Unfortunately this turned out to be incorrect.  Calling mutateStrictFPToFP as I do here *removes the chain*, which causes multiple distinct copies of a floating-point operation with the same input (which need to be duplicated since FP status may change in between) to still be merged at this point.

To fix this, we need to pass strict FP operations through the selection process while keeping the chain intact (i.e. we have to preserve the chain on the resulting MachineSDNode).  But for non-strict operations there is no chain.  So the selection needs to recognize operations with chain and without chain.  I don't see any way with the current selection pattern rules to implement this in a single pattern, so I guess we'll still need to have two patterns for each operation.  On the other hand, I guess the MI instructions themselves don't need to be duplicated any more (only the DAG patterns).

Am I missing something here?   Any other suggestions how to improve this would be appreciated!


https://reviews.llvm.org/D45576





More information about the llvm-commits mailing list