[all-commits] [llvm/llvm-project] 361a3e: [VectorCombine] Fix bailing out of the foldSingleE...

Kacper Doga via All-commits all-commits at lists.llvm.org
Thu Jul 9 09:07:40 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 361a3e692d8c52665e9ab54fae70935d2d1cc458
      https://github.com/llvm/llvm-project/commit/361a3e692d8c52665e9ab54fae70935d2d1cc458
  Author: Kacper Doga <kacper.doga at intel.com>
  Date:   2026-07-09 (Thu, 09 Jul 2026)

  Changed paths:
    M llvm/lib/Transforms/Vectorize/VectorCombine.cpp
    M llvm/test/Transforms/VectorCombine/load-insert-store.ll

  Log Message:
  -----------
  [VectorCombine] Fix bailing out of the foldSingleElementStore with a freeze-pending index (#207702)

`foldSingleElementStore` calls `canScalarizeAccess` to decide whether a
single-element store can be scalarized. When the insert index is not a
constant, is provably in-bounds and may be poison, `canScalarizeAccess`
returns `SafeWithFreeze` and stashes a `ToFreeze` value that must later
be consumed by `freeze()` or cleared by `discard()`.

The bail-out for memory being modified between the load and store was
folded into same condition as the scalarizability check:

```cpp
auto ScalarizableIdx = canScalarizeAccess(...);
if (ScalarizableIdx.isUnsafe() || isMemModifiedBetween(...))
  return false;
```

When the index took the `SafeWithFreeze` path and memory was modified
between the load and the store, `isMemModifiedBetween` returns true and
hit `return false` while ScalarizableIdx still holds a live `ToFreeze`.

Its destructor then raises:
> Assertion !ToFreeze && "freeze() not called with ToFreeze being set"

### Fix
Move the `isMemModifiedBetween` bail-out above the `canScalarizeAccess`
call so the freeze-pending result is never constructed on the path where
we give up.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list