[llvm] [MemCpyOpt] fix miscompile for non-dominated use of src alloca for stack-move optimization (PR #66618)
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 18 02:18:31 PDT 2023
================
@@ -1486,6 +1486,14 @@ bool MemCpyOptPass::performStackMoveOptzn(Instruction *Load, Instruction *Store,
Instruction *I = Worklist.back();
Worklist.pop_back();
for (const Use &U : I->uses()) {
+ auto *UI = cast<Instruction>(U.getUser());
+ // If any use that isn't dominated by SrcAlloca exists, non-dominating
+ // uses will be produced.
+ if (!DT->dominates(SrcAlloca, UI)) {
----------------
nikic wrote:
Add a TODO that we could move the SrcAlloca up instead.
https://github.com/llvm/llvm-project/pull/66618
More information about the llvm-commits
mailing list