-
Notifications
You must be signed in to change notification settings - Fork 13.4k
[MachineLICM] Wrong codegen post-RA due to ignored EH landing pad clobbers #122315
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
Labels
Comments
uweigand
added a commit
to uweigand/llvm-project
that referenced
this issue
Jan 10, 2025
EH landing pad entry implicitly clobbers target-specific exception pointer and exception selector registers. The post-RA MachineLICM pass needs to take these into account when deciding whether to hoist an instruction out of the loop that initializes one of these registers. Fixes: llvm#122315
uweigand
added a commit
to uweigand/llvm-project
that referenced
this issue
Apr 25, 2025
EH landing pad entry implicitly clobbers target-specific exception pointer and exception selector registers. The post-RA MachineLICM pass needs to take these into account when deciding whether to hoist an instruction out of the loop that initializes one of these registers. Fixes: llvm#122315
uweigand
added a commit
to uweigand/llvm-project
that referenced
this issue
Apr 25, 2025
EH landing pad entry implicitly clobbers target-specific exception pointer and exception selector registers. The post-RA MachineLICM pass needs to take these into account when deciding whether to hoist an instruction out of the loop that initializes one of these registers. Fixes: llvm#122315
jyli0116
pushed a commit
to jyli0116/llvm-project
that referenced
this issue
Apr 28, 2025
…lvm#122446) EH landing pad entry implicitly clobbers target-specific exception pointer and exception selector registers. The post-RA MachineLICM pass needs to take these into account when deciding whether to hoist an instruction out of the loop that initializes one of these registers. Fixes: llvm#122315
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiling the following test case on SystemZ:
results in:
The problem is that the initalization of
%r6
was pulled out of the loop. However, the loop includes a path where thepanic
routine throws, and the exception is caught at.Ltmp2
. At this point the register%r6
was clobbered by unwind library code - it is used as the "exception pointer register".Looking at
MachineLICMImpl::HoistRegionPostRA
, there is special code to handle "funclet entry block" by acknowledging they'll implicitly clobber some registers:However, this does not handle Linux-style EH landing pad blocks.
If I add the following code immediately after the above:
the problem disappears. Not sure if this is the best fix - maybe this case should be considered inside
getBeginClobberMask
in the first place?The text was updated successfully, but these errors were encountered: