[PATCH] D73601: [X86] Fix isOffsetSuitableForCodeModel

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 28 18:32:16 PST 2020


MaskRay created this revision.
Herald added subscribers: llvm-commits, hiraditya.
Herald added a project: LLVM.

If hasSymbolicDisplacement is false, there may still be a symbolic
displacement due to the order operands are matched.

  X86DAGToDAGISel::matchAdd
    ...
    // Try again after commuting the operands.
    if (!matchAddressRecursively(Handle.getValue().getOperand(1), AM, Depth+1) && /// sets displacement
        !matchAddressRecursively(Handle.getValue().getOperand(0), AM, Depth+1))   /// sets symbol
      return false;

This can create a `leaq symbol+disp(%rip), %rax` instruction relocated by
R_X86_64_PC32. If symbol+disp-rip>=2**31 there will be a relocation overflow.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D73601

Files:
  llvm/lib/Target/X86/X86ISelDAGToDAG.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D73601.241041.patch
Type: text/x-patch
Size: 6233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200129/60f661e7/attachment.bin>


More information about the llvm-commits mailing list