[all-commits] [llvm/llvm-project] 40c4fe: [SROA] Fix assertion failure when promoting self-r...
Krisitan Erik Olsen via All-commits
all-commits at lists.llvm.org
Fri Jul 17 11:44:55 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 40c4fea67f49b841bd064624219efceab91b65e0
https://github.com/llvm/llvm-project/commit/40c4fea67f49b841bd064624219efceab91b65e0
Author: Krisitan Erik Olsen <kristian.erik at outlook.com>
Date: 2026-07-17 (Fri, 17 Jul 2026)
Changed paths:
M llvm/lib/Transforms/Utils/SSAUpdater.cpp
A llvm/test/Transforms/SROA/sroa-self-referential-load.ll
Log Message:
-----------
[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
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