[llvm] [SCEV] Handle non-constant start values in AddRec UDiv canonicalization. (PR #170474)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 3 12:45:18 PST 2025


https://github.com/fhahn commented:



> I'm a bit concerned that this may actually increase the complexity of the expression in some cases (where it folds to a non-add, but still more complex expression).

We could always be more specific and check if the result is an AddRec with constant ops or a constant if that becomes an issue.

> But LGTM if you're seeing this as beneficial in practice. Assuming no interesting compile-time impact.

It triggers in a few cases in https://github.com/dtcxzyw/llvm-opt-benchmark/pull/3102 (thanks for triggering) and the motivating LV case comes from a workload from @alexhf.

Compile-time looks neutral: https://llvm-compile-time-tracker.com/compare.php?from=45b697e610fd24b4114d78f9d7819fa5e9461371&to=8e69dea2270ead8f00d293fe57ec37cc70807a88&stat=instructions:u

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


More information about the llvm-commits mailing list