[llvm] [LSR] Make OptimizeLoopTermCond able to handle some non-cmp conditions (PR #165590)

John Brawn via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 3 03:58:54 PST 2025


john-brawn-arm wrote:

> I'm trying to understand this code, and I'm not super clear why these preconditions are necessary at all. If IVIncInsertPos is later chosen as the NCD of the uses, doesn't the position of the use not matter?

It looks like the code that copies or moves the cond instruction originated in https://github.com/llvm/llvm-project/commit/9bfa6f8784acd, and is possibly no longer relevant. I had thought that maybe having a different IVUser after the cond instruction could cause problems, but it looks like it doesn't. I'll update this to just not move/copy the cond instruction if it's not a simple cmp instruction.

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


More information about the llvm-commits mailing list