You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is that the initalization of %r6 was pulled out of the loop. However, the loop includes a path where the panic 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:
// Funclet entry blocks will clobber all registers
if (const uint32_t *Mask = BB->getBeginClobberMask(TRI))
applyBitsNotInRegMaskToRegUnitsMask(*TRI, RUClobbers, Mask);
However, this does not handle Linux-style EH landing pad blocks.
If I add the following code immediately after the above:
// EH landing pads clobber exception pointer/selector registers
if (BB->isEHPad()) {
const MachineFunction &MF = *BB->getParent();
if (MF.getFunction().hasPersonalityFn()) {
auto PersonalityFn = MF.getFunction().getPersonalityFn();
const TargetLowering &TLI = *MF.getSubtarget().getTargetLowering();
if (unsigned Reg = TLI.getExceptionPointerRegister(PersonalityFn))
for (MCRegUnitIterator RUI(Reg, TRI); RUI.isValid(); ++RUI)
RUClobbers.set(*RUI);
if (unsigned Reg = TLI.getExceptionSelectorRegister(PersonalityFn))
for (MCRegUnitIterator RUI(Reg, TRI); RUI.isValid(); ++RUI)
RUClobbers.set(*RUI);
}
}
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:
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: