[llvm] [SimplifyIndVar] ICMP predicate conversion to EQ/NE (PR #144945)
Sergey Shcherbinin via llvm-commits
llvm-commits at lists.llvm.org
Thu Dec 4 08:32:30 PST 2025
SergeyShch01 wrote:
> I would suggest rebasing after https://github.com/llvm/llvm-project/pull/170363 has landed.
ok, done
> This is not simply a case of fixing a few small things; the problem is with the approach and the fact that you're proposing duplicating some extremely complicated and risky code
Please note that all introduced logic is actually high-level and can be clearly understood/verified logically. Regular LLVM IR interfaces are used for low-level analysis. Assuming that the regular interfaces are correct then the only potentially dangerous code is that high-level logic which should be simple to verify.
> On your motivating C example, can you explain what you actual goal is?
LoopStrengthReducePass is able to optimize only ICmp w/ EQ condition, otherwise it behaves badly. So this change is to facilitate better work of this pass. In my C example this will lead to instruction count reduction.
> You mention computing a trip count, but the loop seems to be unanalyzable both with and without your patch?
Yes, this is a reason of why LFTR fails and why we need forceEqualityForICmp()
https://github.com/llvm/llvm-project/pull/144945
More information about the llvm-commits
mailing list