[PATCH] D35489: [LoopInterchange] Do not interchange loops with calls to any functions.

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 17 08:50:46 PDT 2017


fhahn created this revision.
Herald added a subscriber: mzolotukhin.

Without any information about the called function, we cannot be sure
that it is safe to interchange loops which contain function calls, for
example there could be dependencies that prevent interchanging between
access in the called function and the loops. Even functions without any
parameters could cause problems, as they could access memory using
global pointers.

For now, I think it is only safe to interchange loops with calls marked
as readnone.

With this patch, the LLVM test suite passes with `-O3 -mllvm
-enable-loopinterchange` and LoopInterchangeProfitability::isProfitable
returning true for all loops.


https://reviews.llvm.org/D35489

Files:
  lib/Transforms/Scalar/LoopInterchange.cpp
  test/Transforms/LoopInterchange/interchange-call-instructions-readnone.ll
  test/Transforms/LoopInterchange/interchange-flow-dep-outer.ll
  test/Transforms/LoopInterchange/not-interchanged-call-instructions.ll
  test/Transforms/LoopInterchange/not-interchanged-tightly-nested.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35489.106884.patch
Type: text/x-patch
Size: 10999 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170717/be106151/attachment.bin>


More information about the llvm-commits mailing list