Author: evancheng Date: Wed Aug 1 18:46:47 2007 New Revision: 40703 URL: http://llvm.org/viewvc/llvm-project?rev=40703&view=rev Log: Can't handle offset and scale if rip-relative addressing is to be used.
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=40703&r1=40702&r2=40703&view=diff ============================================================================== --- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original) +++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Wed Aug 1 18:46:47 2007 @@ -4449,14 +4449,18 @@ return false; if (AM.BaseGV) { - // X86-64 only supports addr of globals in small code model. - if (Subtarget->is64Bit() && - getTargetMachine().getCodeModel() != CodeModel::Small) - return false; - - // We can only fold this if we don't need a load either. + // We can only fold this if we don't need an extra load. if (Subtarget->GVRequiresExtraLoad(AM.BaseGV, getTargetMachine(), false)) return false; + + // X86-64 only supports addr of globals in small code model. + if (Subtarget->is64Bit()) { + if (getTargetMachine().getCodeModel() != CodeModel::Small) + return false; + // If lower 4G is not available, then we must use rip-relative addressing. + if (AM.BaseOffs || AM.Scale > 1) + return false; + } } switch (AM.Scale) { _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits