Skip to content

[TII][X86] Do not schedule frame-setup/frame-destory instructions #96611

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions llvm/lib/Target/X86/X86InstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8832,6 +8832,11 @@ bool X86InstrInfo::isSchedulingBoundary(const MachineInstr &MI,
Opcode == X86::PLDTILECFGV)
return true;

// Frame setup and destory can't be scheduled around.
if (MI.getFlag(MachineInstr::FrameSetup) ||
MI.getFlag(MachineInstr::FrameDestroy))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we put it in TargetInstrInfo::isSchedulingBoundary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of arm tests would fail.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If arm accepts scheduling with frame setup and destory, why can't for X86?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed arm tests: https://buildkite.com/llvm-project/github-pull-requests/builds/75530#01904eb7-13d0-451e-b1da-bcb86cd44b60

.seh_savexmm %xmm15, 544
.seh_endprologue

For X86, most of frame-setup instruction is related to SEH exception restore.
Changing part of its order does not matter. e.g. two independent register save instructions.
Part of them does matter. e.g. .seh_pushreg, moving .seh_endprologue which may affect prologue size.

Anyway, rescheduling frame-setup instruction does not look like profitable for X86.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't see the reason from the log, but I'm good with this change as long as no performance regression for X86.

return true;

return TargetInstrInfo::isSchedulingBoundary(MI, MBB, MF);
}

Expand Down
Loading