artagnon wrote: I think the issue is in IndVarSimplify's handling of the icmp: the code around the SCEV call getLoopInvariantPredicate seems to not handle samesign properly. https://github.com/llvm/llvm-project/pull/124270