@@ -2927,10 +2927,6 @@ bool X86DAGToDAGISel::selectAddr(SDNode *Parent, SDValue N, SDValue &Base,
2927
2927
}
2928
2928
2929
2929
bool X86DAGToDAGISel::selectMOV64Imm32 (SDValue N, SDValue &Imm) {
2930
- // Cannot use 32 bit constants to reference objects in kernel code model.
2931
- if (TM.getCodeModel () == CodeModel::Kernel)
2932
- return false ;
2933
-
2934
2930
// In static codegen with small code model, we can get the address of a label
2935
2931
// into a register with 'movl'
2936
2932
if (N->getOpcode () != X86ISD::Wrapper)
@@ -2944,18 +2940,15 @@ bool X86DAGToDAGISel::selectMOV64Imm32(SDValue N, SDValue &Imm) {
2944
2940
return false ;
2945
2941
2946
2942
Imm = N;
2947
- // Small/medium code model can reference non-TargetGlobalAddress objects with
2948
- // 32 bit constants.
2949
- if (N->getOpcode () != ISD::TargetGlobalAddress) {
2950
- return TM.getCodeModel () == CodeModel::Small ||
2951
- TM.getCodeModel () == CodeModel::Medium;
2952
- }
2943
+ if (N->getOpcode () != ISD::TargetGlobalAddress)
2944
+ return TM.getCodeModel () == CodeModel::Small;
2953
2945
2954
- const GlobalValue *GV = cast<GlobalAddressSDNode>(N)->getGlobal ();
2955
- if (std::optional<ConstantRange> CR = GV->getAbsoluteSymbolRange ())
2956
- return CR->getUnsignedMax ().ult (1ull << 32 );
2946
+ std::optional<ConstantRange> CR =
2947
+ cast<GlobalAddressSDNode>(N)->getGlobal ()->getAbsoluteSymbolRange ();
2948
+ if (!CR)
2949
+ return TM.getCodeModel () == CodeModel::Small;
2957
2950
2958
- return !TM. isLargeGlobalValue (GV );
2951
+ return CR-> getUnsignedMax (). ult ( 1ull << 32 );
2959
2952
}
2960
2953
2961
2954
bool X86DAGToDAGISel::selectLEA64_32Addr (SDValue N, SDValue &Base,
0 commit comments