Skip to content

Commit b557165

Browse files
committed
Revert "[X86][FastISel] Support medium code model in more places (llvm#75375)"
This reverts commit c64334f.
1 parent 5cbc7cc commit b557165

File tree

3 files changed

+6
-57
lines changed

3 files changed

+6
-57
lines changed

llvm/lib/Target/X86/X86FastISel.cpp

+6-12
Original file line numberDiff line numberDiff line change
@@ -711,8 +711,7 @@ bool X86FastISel::handleConstantAddresses(const Value *V, X86AddressMode &AM) {
711711
// Handle constant address.
712712
if (const GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
713713
// Can't handle alternate code models yet.
714-
if (TM.getCodeModel() != CodeModel::Small &&
715-
TM.getCodeModel() != CodeModel::Medium)
714+
if (TM.getCodeModel() != CodeModel::Small)
716715
return false;
717716

718717
// Can't handle TLS yet.
@@ -1045,8 +1044,7 @@ bool X86FastISel::X86SelectCallAddress(const Value *V, X86AddressMode &AM) {
10451044
// Handle constant address.
10461045
if (const GlobalValue *GV = dyn_cast<GlobalValue>(V)) {
10471046
// Can't handle alternate code models yet.
1048-
if (TM.getCodeModel() != CodeModel::Small &&
1049-
TM.getCodeModel() != CodeModel::Medium)
1047+
if (TM.getCodeModel() != CodeModel::Small)
10501048
return false;
10511049

10521050
// RIP-relative addresses can't have additional register operands.
@@ -3771,8 +3769,7 @@ unsigned X86FastISel::X86MaterializeFP(const ConstantFP *CFP, MVT VT) {
37713769

37723770
// Can't handle alternate code models yet.
37733771
CodeModel::Model CM = TM.getCodeModel();
3774-
if (CM != CodeModel::Small && CM != CodeModel::Medium &&
3775-
CM != CodeModel::Large)
3772+
if (CM != CodeModel::Small && CM != CodeModel::Large)
37763773
return 0;
37773774

37783775
// Get opcode and regclass of the output for the given load instruction.
@@ -3810,7 +3807,7 @@ unsigned X86FastISel::X86MaterializeFP(const ConstantFP *CFP, MVT VT) {
38103807
PICBase = getInstrInfo()->getGlobalBaseReg(FuncInfo.MF);
38113808
else if (OpFlag == X86II::MO_GOTOFF)
38123809
PICBase = getInstrInfo()->getGlobalBaseReg(FuncInfo.MF);
3813-
else if (Subtarget->is64Bit() && TM.getCodeModel() != CodeModel::Large)
3810+
else if (Subtarget->is64Bit() && TM.getCodeModel() == CodeModel::Small)
38143811
PICBase = X86::RIP;
38153812

38163813
// Create the load from the constant pool.
@@ -3840,11 +3837,8 @@ unsigned X86FastISel::X86MaterializeFP(const ConstantFP *CFP, MVT VT) {
38403837
}
38413838

38423839
unsigned X86FastISel::X86MaterializeGV(const GlobalValue *GV, MVT VT) {
3843-
// Can't handle large GlobalValues yet.
3844-
if (TM.getCodeModel() != CodeModel::Small &&
3845-
TM.getCodeModel() != CodeModel::Medium)
3846-
return 0;
3847-
if (!isa<GlobalObject>(GV) || TM.isLargeGlobalObject(cast<GlobalObject>(GV)))
3840+
// Can't handle alternate code models yet.
3841+
if (TM.getCodeModel() != CodeModel::Small)
38483842
return 0;
38493843

38503844
// Materialize addresses with LEA/MOV instructions.

llvm/test/CodeGen/X86/fast-isel-constpool.ll

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
22
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small < %s | FileCheck %s
3-
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=medium < %s | FileCheck %s
43
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=large < %s | FileCheck %s --check-prefix=LARGE
54
; RUN: llc -mtriple=x86_64 -fast-isel -code-model=large -relocation-model=pic < %s | FileCheck %s --check-prefix=LARGE_PIC
65
; RUN: llc -mtriple=x86_64-apple-darwin -fast-isel -code-model=small -mattr=avx < %s | FileCheck %s --check-prefix=AVX

llvm/test/CodeGen/X86/fast-isel-medium-code-model.ll

-44
This file was deleted.

0 commit comments

Comments
 (0)