I am trying to use shrink-wrap for some early exit programs and understanding ShrinkWrap Pass. I found a check in shrinkWrapPass which is very conservative and bailed out, and missing the opportunity of early exit for which this optimization is indented.
The change is a four year old fix which was introduce to fix the violation as per AAPCS for AArch64 target. But It is made generic for all the other architecture also.
if (MI.mayLoadOrStore())
return true;
Does such kind of check applicable for X86 architecture also? Is it sound to enable this check for AArch64 only and relax the condition for other architecture?
Hi,
That’s a quite old one. I don’t know about the x86 calling convention, but I would imagine a premature stack restoring would affect most archs in possibly destroying an unprotected stack during an exception treatment. Perhaps @RKSimon could share his view from the x86 side. If you do have an arch that does not suffer from it, yes, adding a hook in the TargetLoweringInfo sounds as a good solution.
Cheers