[PATCH] D28170: [LICM] When promoting scalars, allow inserting stores to thread-local allocas

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 18 15:05:05 PST 2017


efriedma added inline comments.


================
Comment at: llvm/trunk/lib/Transforms/Scalar/LICM.cpp:1037
     SafeToInsertStore =
-        isAllocLikeFn(Object, TLI) && !PointerMayBeCaptured(Object, true, true);
+        (isAllocLikeFn(Object, TLI) || isa<AllocaInst>(Object)) &&
+        !PointerMayBeCaptured(Object, true, true);
----------------
trentxintong wrote:
> The question I really want to ask is whether the check for MayNotBeCaptured is necessary for Alloca. Should not alloca be implicitly thread local ? The language reference does not explicitly state it.
In general, memory allocated using alloca can be used in all the same ways you could use memory allocated with malloc().  Not sure what sort of restriction you're expecting.


Repository:
  rL LLVM

https://reviews.llvm.org/D28170





More information about the llvm-commits mailing list