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 |
||
|---|---|---|
| .. | ||
| benchmarks | ||
| bindings | ||
| cmake | ||
| docs | ||
| examples | ||
| include | ||
| lib | ||
| projects | ||
| resources | ||
| runtimes | ||
| test | ||
| tools | ||
| unittests | ||
| utils | ||
| .clang-format | ||
| .clang-tidy | ||
| .gitattributes | ||
| .gitignore | ||
| CMakeLists.txt | ||
| CMakePresets.json | ||
| configure | ||
| CREDITS.TXT | ||
| LICENSE.TXT | ||
| Maintainers.md | ||
| 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.