[PATCH] D136102: [LoopSimplify] Update loop-metadata ID after loop-simplify splitting out new outer loop

Mikael Holmén via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 24 01:31:15 PDT 2022


uabelho added a comment.

In D136102#3872160 <https://reviews.llvm.org/D136102#3872160>, @Narutoworld wrote:

> Hi Mikael
> Thanks for the comment.
>
> I used to think the most conservative option is to always keep original metadata. 
> However, in this case, the most conservative choice seems to remove all metadata other than its loop ID.
>
> I think it might be a better design to drop all metadata of a loop which is touched by loop-simplify, I'd appreciate it if you could let me know your thoughts.
>
> BTW, do you have the C/C++ code snippet which generate the IRs ? It would be more reasonable that different latches should hold different metadata even if they belongs to the same loop.

The original C code looked roughly like

  void foo()
  {
      int i = 0;
      int j = 0;
  
      _Pragma("loop minitercount(1)")
      while (i < 10 || j != 5)
      {
          i++;
          if (i == 12)
          {
              j = 5;
          }
      }
  
      assert(i == 12);
  }

note that the "minitercount" pragma is something we've added downstream, that does not exist in a normal clang.
When we saw this error it was with a non-standard opt pipeline, but after a bit of debugging we thought it looked like
loop-simplify behaved strange and wrote https://github.com/llvm/llvm-project/issues/57603
But I don't know really what the solution is or how different passes should handle metadata in general.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136102



More information about the llvm-commits mailing list