Skip to content

Commit 4129507

Browse files
authored
Revert "[X86] Recognize POP/ADD/SUB modifying rsp in getSPAdjust. (#114265)"
This reverts commit 6fb7cdf.
1 parent cfd67c2 commit 4129507

File tree

4 files changed

+3
-132
lines changed

4 files changed

+3
-132
lines changed

llvm/lib/Target/X86/X86InstrInfo.cpp

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -451,13 +451,10 @@ int X86InstrInfo::getSPAdjust(const MachineInstr &MI) const {
451451
return -(I->getOperand(1).getImm());
452452
}
453453

454-
// Handle other opcodes we reasonably expect to see in call
455-
// sequences. Note this may include spill/restore of FP/BP.
454+
// Currently handle only PUSHes we can reasonably expect to see
455+
// in call sequences
456456
switch (MI.getOpcode()) {
457457
default:
458-
assert(!(MI.modifiesRegister(X86::RSP, &RI) ||
459-
MI.getDesc().hasImplicitDefOfPhysReg(X86::RSP)) &&
460-
"Unhandled opcode in getSPAdjust");
461458
return 0;
462459
case X86::PUSH32r:
463460
case X86::PUSH32rmm:
@@ -469,30 +466,6 @@ int X86InstrInfo::getSPAdjust(const MachineInstr &MI) const {
469466
case X86::PUSH64rmr:
470467
case X86::PUSH64i32:
471468
return 8;
472-
case X86::POP32r:
473-
case X86::POP32rmm:
474-
case X86::POP32rmr:
475-
return -4;
476-
case X86::POP64r:
477-
case X86::POP64rmm:
478-
case X86::POP64rmr:
479-
return -8;
480-
// FIXME: (implement and) use isAddImmediate in the
481-
// default case instead of the following ADD/SUB cases.
482-
case X86::ADD32ri:
483-
case X86::ADD32ri8:
484-
case X86::ADD64ri32:
485-
if (MI.getOperand(0).getReg() == X86::RSP &&
486-
MI.getOperand(1).getReg() == X86::RSP)
487-
return -MI.getOperand(2).getImm();
488-
return 0;
489-
case X86::SUB32ri:
490-
case X86::SUB32ri8:
491-
case X86::SUB64ri32:
492-
if (MI.getOperand(0).getReg() == X86::RSP &&
493-
MI.getOperand(1).getReg() == X86::RSP)
494-
return MI.getOperand(2).getImm();
495-
return 0;
496469
}
497470
}
498471

llvm/lib/Target/X86/X86MachineFunctionInfo.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ using namespace llvm;
1515

1616
yaml::X86MachineFunctionInfo::X86MachineFunctionInfo(
1717
const llvm::X86MachineFunctionInfo &MFI)
18-
: AMXProgModel(MFI.getAMXProgModel()),
19-
FPClobberedByCall(MFI.getFPClobberedByCall()),
20-
HasPushSequences(MFI.getHasPushSequences()) {}
18+
: AMXProgModel(MFI.getAMXProgModel()) {}
2119

2220
void yaml::X86MachineFunctionInfo::mappingImpl(yaml::IO &YamlIO) {
2321
MappingTraits<X86MachineFunctionInfo>::mapping(YamlIO, *this);
@@ -33,8 +31,6 @@ MachineFunctionInfo *X86MachineFunctionInfo::clone(
3331
void X86MachineFunctionInfo::initializeBaseYamlFields(
3432
const yaml::X86MachineFunctionInfo &YamlMFI) {
3533
AMXProgModel = YamlMFI.AMXProgModel;
36-
FPClobberedByCall = YamlMFI.FPClobberedByCall;
37-
HasPushSequences = YamlMFI.HasPushSequences;
3834
}
3935

4036
void X86MachineFunctionInfo::anchor() { }

llvm/lib/Target/X86/X86MachineFunctionInfo.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ template <> struct ScalarEnumerationTraits<AMXProgModelEnum> {
3838

3939
struct X86MachineFunctionInfo final : public yaml::MachineFunctionInfo {
4040
AMXProgModelEnum AMXProgModel;
41-
bool FPClobberedByCall;
42-
bool HasPushSequences;
4341

4442
X86MachineFunctionInfo() = default;
4543
X86MachineFunctionInfo(const llvm::X86MachineFunctionInfo &MFI);
@@ -51,8 +49,6 @@ struct X86MachineFunctionInfo final : public yaml::MachineFunctionInfo {
5149
template <> struct MappingTraits<X86MachineFunctionInfo> {
5250
static void mapping(IO &YamlIO, X86MachineFunctionInfo &MFI) {
5351
YamlIO.mapOptional("amxProgModel", MFI.AMXProgModel);
54-
YamlIO.mapOptional("FPClobberedByCall", MFI.FPClobberedByCall, false);
55-
YamlIO.mapOptional("hasPushSequences", MFI.HasPushSequences, false);
5652
}
5753
};
5854
} // end namespace yaml

llvm/test/CodeGen/X86/pr114265.mir

Lines changed: 0 additions & 94 deletions
This file was deleted.

0 commit comments

Comments
 (0)