diff options
Diffstat (limited to 'llvm/lib/Target/X86/X86ISelDAGToDAG.cpp')
| -rw-r--r-- | llvm/lib/Target/X86/X86ISelDAGToDAG.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp index f7fd221b517..754e74c77a8 100644 --- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp +++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp @@ -940,11 +940,13 @@ bool X86DAGToDAGISel::matchWrapper(SDValue N, X86ISelAddressMode &AM) { bool IsRIPRel = N.getOpcode() == X86ISD::WrapperRIP; - // Only do this address mode folding for 64-bit if we're in the small code - // model. - // FIXME: But we can do GOTPCREL addressing in the medium code model. + // We can't use an addressing mode in the 64-bit large code model. In the + // medium code model, we use can use an mode when RIP wrappers are present. + // That signifies access to globals that are known to be "near", such as the + // GOT itself. CodeModel::Model M = TM.getCodeModel(); - if (Subtarget->is64Bit() && M != CodeModel::Small && M != CodeModel::Kernel) + if (Subtarget->is64Bit() && + (M == CodeModel::Large || (M == CodeModel::Medium && !IsRIPRel))) return true; // Base and index reg must be 0 in order to use %rip as base. |

