[LICM] Store promotion when memory is thread local

Description

[LICM] Store promotion when memory is thread local

This patch teaches LICM's implementation of store promotion to exploit the fact that the memory location being accessed might be provable thread local. The fact it's thread local weakens the requirements for where we can insert stores since no other thread can observe the write. This allows us perform store promotion even in cases where the store is not guaranteed to execute in the loop.

Two key assumption worth drawing out is that this assumes a) no-capture is strong enough to imply no-escape, and b) standard allocation functions like malloc, calloc, and operator new return values which can be assumed not to have previously escaped.

In future work, it would be nice to generalize this so that it works without directly seeing the allocation site. I believe that the nocapture return attribute should be suitable for this purpose, but haven't investigated carefully. It's also likely that we could support unescaped allocas with similar reasoning, but since SROA and Mem2Reg should destroy those, they're less interesting than they first might seem.

Differential Revision: http://reviews.llvm.org/D16783

Details

Committed
reamesMar 9 2016, 2:59 PM
Differential Revision
D16783: [LICM] Store promotion when memory is thread local
Parents
rL263071: Use %t as the output file name to avoid repetition. NFC.
Branches
Unknown
Tags
Unknown