[llvm] [SeparateConstOffsetFromGEP] Reorder trivial GEP chains to separate constants (PR #73056)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 11:02:06 PST 2024


jrbyrnes wrote:

> Specifically, I claim that, if you can prove that the constant and variable indices are non-negative, you should be able to reassociate the inbounds GEPs soundly.

Thanks @krzysz00  for pointing that out -- I agree with that claim and have added to the most recent version

> do we know which of these is more likely to lead to good codegen

I'm not quite sure; I think I'd have to analyze empirically.

My initial thought was to disable the reordering if we lose inbounds to avoid introducing regressions, however, most of the optimizations that depend on typically occur earlier in the pipeline. 
 



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


More information about the llvm-commits mailing list