[PATCH] D89341: [X86] Encode global symbol address in sub if possible

Wei Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 15 11:36:16 PDT 2020


weiwang added a comment.

In D89341#2331338 <https://reviews.llvm.org/D89341#2331338>, @craig.topper wrote:

> In D89341#2328996 <https://reviews.llvm.org/D89341#2328996>, @weiwang wrote:
>
>> Thanks for the comment, Craig.
>>
>> `isSExtAbsoluteSymbolRef ` does seem to check for the width of immediate. If the immediate can be encoded directly, the node should be replaced with one of the `SUB64ri*` nodes. I think the `X86Wrapper` node can be replaced with a corresponding `imm` node if conditions are met, then the matching can proceed.
>
> I was thinking that if we don't have range information from getAbsoluteSymbolRange, but the Width passed to isSExtAbsoluteSymbolRef is 32 and the code model is small we could return true?

Yes, I think it is possible to do that. The similar check is also done in `X86DAGToDAGISel::selectMOV64Imm32`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D89341



More information about the llvm-commits mailing list