[llvm] [InstCombine] Merge foldFreezeIntoRecurrence into pushFreezeToPreventPoisonFromPropagating (PR #171435)

Cullen Rhodes via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 10 09:16:09 PST 2025


c-rhodes wrote:

in the first iteration there were some hangs https://github.com/dtcxzyw/llvm-opt-benchmark/pull/3129, I got a reduced testcase for acv and fixed it with the latest commit.

Re-ran yesterday and there's more hangs: https://github.com/dtcxzyw/llvm-opt-benchmark/pull/3130. I reduced miniz to: https://godbolt.org/z/cTqcxP9j4

it gets stuck in a loop of:
```
IC: Visiting:   %8 = zext i32 %7 to i64
IC: Mod =   %8 = zext i32 %7 to i64
    New =   %8 = zext nneg i32 %7 to i64
ADD:   %9 = freeze i64 %8
ADD:   %8 = zext nneg i32 %7 to i64
IC: Visiting:   %8 = zext nneg i32 %7 to i64
IC: Visiting:   %9 = freeze i64 %8
ADD DEFERRED:   %8 = zext i32 %7 to i64
ADD DEFERRED:   %7 = lshr i32 %6, 3
ADD DEFERRED:   %6 = add i32 %.2826, -8
ADD:   %8 = zext i32 %7 to i64
```
which is caused by https://github.com/llvm/llvm-project/blob/54b4bd510a8cc90fac3d2071179d1424af894c9c/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp#L1581-L1595
adding `nneg` then pushFreezeToPreventPoisonFromPropagating dropping it.

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


More information about the llvm-commits mailing list