[PATCH] Don't index the static alloca map with dynamic alloca's for lifetime intrinsics

Pete Cooper peter_cooper at apple.com
Fri Oct 17 15:47:51 PDT 2014


Hi all

TL;DR: Indexing maps with [] creates missing entries.

The long version:

When selecting lifetime intrinsics, we index the *static* alloca map with the AllocaInst we find for that lifetime.  Trouble is, we don't first check to see if this is a dynamic alloca.

On the attached example, this causes a dynamic alloca to create an entry in the static map, and returns 0 (the default) as the frame index for that lifetime.  0 was used for the frame index of the stack protector, which given that it now has a lifetime, is coloured, and merged with other stack slots.

PEI would later trigger an assert because it expects the stack protector to not be dead.

This fix ensures that we only get the frame indices for static allocas, ie, those in the map.  Dynamic ones are effectively dropped, which is suboptimal, but at least isn't completely broken.

rdar://problem/18672951 <rdar://problem/18672951>

Thanks,
Pete

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141017/74bb0e62/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-for-dynamic-alloca-s-when-selecting-lifetime-i.patch
Type: application/octet-stream
Size: 3852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141017/74bb0e62/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20141017/74bb0e62/attachment-0001.html>


More information about the llvm-commits mailing list