[PATCH] D12771: [LICM] Hoist calls to readonly argmemonly functions even with stores in the loop

Sanjoy Das via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 16 19:56:03 PDT 2015


sanjoy added inline comments.

================
Comment at: lib/Transforms/Scalar/LICM.cpp:468-471
@@ +467,6 @@
+      if (AliasAnalysis::onlyAccessesArgPointees(Behavior)) {
+        for (Value *Op : CI->arg_operands())
+          if (Op->getType()->isPointerTy() &&
+              pointerInvalidatedByLoop(Op, MemoryLocation::UnknownSize,
+                                       AAMDNodes(), CurAST))
+            return false;
----------------
majnemer wrote:
> majnemer wrote:
> > Is the function permitted to bitcast it's non-pointer parameters and store to them?
> Ah, the langref answers this question...
I had the exact same question earlier. :)  Turns out, the specification for `argmemonly` forbids that -- an `argmemonly` function can only store through *pointer typed* arguments.

"This attribute indicates that the only memory accesses inside function are loads and stores from objects pointed to by its pointer-typed arguments, with arbitrary offsets."


http://reviews.llvm.org/D12771





More information about the llvm-commits mailing list