Index: llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp =================================================================== --- llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -705,11 +705,9 @@ // Calls that only access inaccessible memory cannot read or write any memory // locations we consider for elimination. if (auto *CB = dyn_cast(DI)) - if (CB->onlyAccessesInaccessibleMemory()) { - if (isAllocLikeFn(DI, &TLI)) - return false; + if (CB->onlyAccessesInaccessibleMemory()) return true; - } + // We can eliminate stores to locations not visible to the caller across // throwing instructions. if (DI->mayThrow() && !DefVisibleToCaller)