[llvm] [LoopIdiomVectorize] Recognize and transform minidx pattern (PR #144987)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 04:02:34 PDT 2025


madhur13490 wrote:

> > @sjoerdmeijer See also some related discussion on #141556. My takeaway from that was that this really needs a GVN improvement first.
> 
> There's quite some discussion going on there, but I think you're referring to this comment:
> 
> > but it feels like the focus we should be trying to optimise the scalar IR before we attempt vectorisation. There are no stores in the loop and the bounds seem to be well-known.
> 
> My understanding is that there's two ways to optimise this:
> 
> * GVN, which is the scalar optimisation we are talking about it. GCC is doing this PRE, and that's how this came up, as a case where we are behind.
> * But GVN and NewGVN is a difficult story, and then we found that vectorisation is actually the much better approach. The vectorisation performance gain is much bigger than the gain we get from PRE and GVN.
> 
> Isn't that right, or am I missing something, @madhur13490 ?

That's right. NewGVN is not in good shape, and @nikic said [here](https://discourse.llvm.org/t/newgvn-gvn-pre-plans/84746/4?u=madhur13490), we may want to delete it in the future. So, I wouldn't put any eggs there. 

https://github.com/llvm/llvm-project/pull/144987


More information about the llvm-commits mailing list