[PATCH] D28834: Improve what can be promoted in LICM.

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 17 16:42:09 PST 2017


efriedma added inline comments.


================
Comment at: lib/Transforms/Scalar/LICM.cpp:1014-1015
+    // even though its not captured by the enclosing function. Standard allocation
+    // functions like malloc, calloc, and operator new return values which can
+    // be assumed not to have previously escaped.
+    Value *Object = GetUnderlyingObject(SomePtr, MDL);
----------------
Is there an existing testcase which covers this?


================
Comment at: lib/Transforms/Scalar/LICM.cpp:1018
+    if (!isa<AllocaInst>(Object) &&
+        (!isAllocLikeFn(Object, TLI) || PointerMayBeCaptured(Object, true, true)))
       return false;
----------------
Can we avoid calling PointerMayBeCaptured twice?  (We perform a similar check later in this function.)


================
Comment at: test/Transforms/LICM/scalar-promote-unwind.ll:173
+for.cond.cleanup:
+  ret void
+}
----------------
It would be more useful to have a testcase which doesn't leak memory.


https://reviews.llvm.org/D28834





More information about the llvm-commits mailing list