[PATCH] D154205: [MachineLICM] Handle subloops

JinGu Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 30 07:36:38 PDT 2023


jaykang10 added a comment.

In D154205#4463750 <https://reviews.llvm.org/D154205#4463750>, @dmgreen wrote:

> It has always been a bit strange that this only tries to sink out of outermost loops. This looks like it will try the largest loop first, which sound like it makes sense.
>
> Are there other tests that need to be updated?

This change makes MachineLICM handle the loops from inner-most to out-most. If there is loop invariant code in inner-most loop, it will be hoisted to the pre-header of the inner-most loop first and then to outer loop gradually.
MachineLICM is target independent CodeGen pass so I am checking tests of other targets too.



================
Comment at: llvm/test/CodeGen/AArch64/machine-licm-sub-loop.ll:5
 ; Function Attrs: nofree norecurse nosync nounwind memory(argmem: readwrite) uwtable
 define dso_local void @foo(i32 noundef %limit, ptr nocapture noundef %out, ptr nocapture noundef readonly %y) local_unnamed_addr #0 {
 ; CHECK-LABEL: foo:
----------------
dmgreen wrote:
> I tend to remove the `Function Attrs` along with `dso_local` and the `local_unnamed_addr #0`
Sorry, I added this test as an experimental example.
Let me tidy up this test.


================
Comment at: llvm/test/CodeGen/AArch64/machine-licm-sub-loop.ll:168-169
 
 !llvm.module.flags = !{!0, !1, !2, !3, !4}
 !llvm.ident = !{!5}
 
----------------
dmgreen wrote:
> I don't believe these are used for anything.
ditto


================
Comment at: llvm/test/CodeGen/AArch64/machine-licm-sub-loop.ll:171
 
 !0 = !{i32 1, !"wchar_size", i32 4}
 !1 = !{i32 8, !"PIC Level", i32 2}
----------------
dmgreen wrote:
> And can you remove as much of this as you can.
ditto


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

https://reviews.llvm.org/D154205



More information about the llvm-commits mailing list