[PATCH] fix for PR16393: miscompile with struct byval

Manman Ren mren at apple.com
Thu Jul 11 21:14:37 PDT 2013


On Jul 11, 2013, at 6:43 PM, Jakob Stoklund Olesen wrote:

> 
> On Jul 11, 2013, at 5:53 PM, Manman Ren <mren at apple.com> wrote:
> 
>> Attached patch after refactoring (at r186141).
> 
> Neat, thanks.
> 
>> The patch removes a rudimentary check in PEI: it is invalid when we have a
>> FrameDestroy <n> followed by a FrameSetup <m> in a single basic block.
> 
> I would like to see some comments explaining what is going on, but otherwise I am really happy with this approach.

PEI currently has the following check SPAdjCount || SPAdj == 0.
It tries to assert that when we have matched pairs of Setup and Destroy within a basic block, SPAdj within the basic block should be zero.

SPAdjCount++ for a Setup and SPAdjCount-- for a Destroy.
When we have a Destroy then a Setup, SPAdjCount is 0, but we don't have matched pairs of Setup and Destroy.
Specifically if we have a Destroy <n> followed by a Setup <m>, PEI will assert failure.

We can add an extra condition to make sure the pairs are matched:
   The pairs start with a Setup.

But since we are doing a much better job at the verifier, maybe we can just remove the check in PEI.

Thanks,
Manman

> 
> Jim, what do you think about this kind of PEI change?
> 
> /jakob
> 




More information about the llvm-commits mailing list