mirror-llvm-project/llvm
Krisitan Erik Olsen 40c4fea67f
[SROA] Fix assertion failure when promoting self-referential load/store (#208826)
When LoadAndStorePromoter::run processes a block where a store's value
operand is defined by the load being promoted (a self-referential cycle
in unreachable code), it sets StoredValue to the load instruction. When
it then calls replaceAllUsesWith, the doRAUW assertion fires because the
replacement value contains the value being replaced.

The single-block promotion paths in promoteSingleBlockAlloca already
guard against this with a check for ReplVal == LI, replacing with poison
instead. This patch adds the same guard to the in-block load path in
LoadAndStorePromoter::run, which was missing it. Substituting poison is
correct here since this situation only arises in unreachable code.

The regression was introduced in #135609, which added the
propagateStoredValuesToLoads path in SROA that routes through
LoadAndStorePromoter::run. LoadStoreRewriter handles aggregates and is
unrelated to this path.

Fixes #204799
2026-07-17 11:44:34 -07:00
..
benchmarks [ADT] Make canonicalization a compile-time parameter of ImmutableSet/Map (#209300) 2026-07-14 18:13:09 +00:00
bindings
cmake [Flang][CMake] Use fakeflang as dispatcher (#209482) 2026-07-16 13:19:05 +02:00
docs Modify lit config to allow specify extra env vars to pass through to lit invocation (#208239) 2026-07-17 08:05:11 -07:00
examples
include [SystemZ][z/OS] Fix zos_translation_time module flag (#210058) 2026-07-17 08:10:10 -04:00
lib [SROA] Fix assertion failure when promoting self-referential load/store (#208826) 2026-07-17 11:44:34 -07:00
projects
resources
runtimes [LLVM] Fix not passing CMAKE_CROSSCOMPILING_EMULATOR for amdgpu (#209828) 2026-07-15 12:49:02 -05:00
test [SROA] Fix assertion failure when promoting self-referential load/store (#208826) 2026-07-17 11:44:34 -07:00
tools [llvm-reduce] Fix !inline_history verifier issues (#199373) 2026-07-16 10:20:52 -07:00
unittests Add expression validation tests for DW_OP_swap (#210184) 2026-07-16 18:10:18 -07:00
utils [gn build] Port 40ae05d477 (#210357) 2026-07-17 11:20:42 -04:00
.clang-format
.clang-tidy
.gitattributes
.gitignore
CMakeLists.txt [AMDGPU] Update libc/runtime target to use amdgpu (#210032) 2026-07-16 10:32:51 -05:00
CMakePresets.json
configure
CREDITS.TXT
LICENSE.TXT
Maintainers.md [LLVM][Maintainers] Volunteer for LoopUnroll (#207802) 2026-07-08 17:35:07 +00:00
README.txt
RELEASE_TESTERS.TXT

The LLVM Compiler Infrastructure
================================

This directory and its subdirectories contain source code for LLVM,
a toolkit for the construction of highly optimized compilers,
optimizers, and runtime environments.

LLVM is open source software. You may freely distribute it under the terms of
the license agreement found in LICENSE.txt.

Please see the documentation provided in docs/ for further
assistance with LLVM, and in particular docs/GettingStarted.md for getting
started with LLVM and docs/README.txt for an overview of LLVM's
documentation setup.

If you are writing a package for LLVM, see docs/Packaging.rst for our
suggestions.