[llvm] [SCEV] Pass loop pred branch as context instruction to getMinTrailingZ. (PR #160941)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 13:51:26 PDT 2025


fhahn wrote:

> Why are we handling this case via context instruction rather than loop guards?

Ah yes good question, I forgot to mention that. I think to use loop guards, we would need to rewrite `%ptr` to an pointer expression that encodes the alignment information, but I am not sure if there's a good way to do so currently? 

The only way I could think of would be something like the equivalent to ` %ptr -> inttoptr (4 * (ptrtoint %ptr) / 4)` and I thought that kind of re-write would be more likely to have negative side-effects for other users of loop guards, but perhaps there's a better way?



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


More information about the llvm-commits mailing list