<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>Hi Quentin,</div><div><br></div><div>Thanks for your review!</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

This is kind of strange that the patch introduces a target hook for isAsCheapAsMove, whereas it uses the flag isRematerializable to mark the interesting instructions.<br>
Indeed, it seems kind of arbitrary which instructions are marked rematerializable and which instructions are not. If we want to pursue this way, I believe that we have to clarify the semantic of this flag.<br>
<br>
The isRematerializable flag is also in a weird situation. Indeed, according to the documentation, it is deprecated:<br>
  /// isRematerializable - Returns true if this instruction is a candidate for<br>
  /// remat.  This flag is deprecated, please don't use it anymore.  If this<br>
  /// flag is set, the isReallyTriviallyReMaterializable() method is called to<br>
  /// verify the instruction is really rematable.<br>
But it is used in TargetInstrInfo::isTriviallyRematerializable.<br>
<br>
Since, you are touching this part, I believe that we should either fix the implementation of isTrivallyRematerializable and really deprecate this flag, or update the comment to reflect the actual semantic (which needs to be defined) of this flag.<br>
</blockquote><div><br></div><div>Sorry that I really didn't notice that this flag is deprecated. I can see isReMaterializable flag is being used in a lot of .td files. Do you mean because this flag is being used in an arbitrary manner everywhere, we want to work out another more centralized solution to describe rematerializable attribute? Or we needn't this flag at all, and the algorithm of rematerialization should just check cost like the info provided by isAsCheapAsMove?</div>
<div><br></div><div>Thanks,</div><div>-Jiangning</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
Thanks,<br>
-Quentin<br></blockquote></div></div></div>