[PATCH] D60056: Hoist/sink malloc/free's in LICM.

Nick Lewycky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 1 19:45:52 PDT 2019


nicholas added a comment.

In D60056#1450884 <https://reviews.llvm.org/D60056#1450884>, @nicholas wrote:

> Should I pull it out of hoisting and sinking and into a post-pass like LICM's scalar promotion? Initially I had imagined that it would participate in hoist and sink's queries of whether "are all arguments to this instruction loop invariant (outside the loop)" as hoists instructions iterately, it would hoist malloc like any other instruction. In practice that couldn't happen because the hoist is deferred until sink time.


Er, I'm mistaken. It does, because sinkRegion happens first and doesn't call isLoopInvariant, then hoistRegion happens second and that uses isLoopInvariant. So in theory if you have something like ptrtoint of the malloc (maybe an alignment check?), we could hoist that out of the loop too. So it does interlace with the rest of hoistRegion, and that's important for optimization power. I'll add a test to that effect shortly.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D60056/new/

https://reviews.llvm.org/D60056





More information about the llvm-commits mailing list