[PATCH] D118076: Sinking or hoisting instructions between loops before fusion

Joshua Cranmer via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 25 14:19:49 PDT 2022


jcranmer-intel accepted this revision.
jcranmer-intel added inline comments.
This revision is now accepted and ready to land.


================
Comment at: llvm/test/Transforms/LoopFusion/no_sink_hoist_store.ll:25
+pre2:
+  %ptr = alloca i32
+  store i32 3, i32* %ptr
----------------
aaronkintel wrote:
> jcranmer-intel wrote:
> > The alloca should be in the entry block for this test, should it not?
> Do you mean it should be:
> pre1:
>   %ptr = alloca i32
> ....
> pre2: 
>   store i32 3, i32* %ptr
> 
> What is the reason for this?
`alloca` instructions are generally expected to occur at the beginning of the function's entry block; if they're not, then they're a dynamic alloca block, which can have unexpected impacts on other optimizations. Unless there's a good reason for the `alloca` not to live in the entry block, then they should be generated in the entry block.


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

https://reviews.llvm.org/D118076



More information about the llvm-commits mailing list