/*========================== begin_copyright_notice ============================ Copyright (C) 2023-2024 Intel Corporation SPDX-License-Identifier: MIT ============================= end_copyright_notice ===========================*/ /*========================== begin_copyright_notice ============================ Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. See https://llvm.org/LICENSE.txt for license information. SPDX-License-Identifier: Apache-2.0 with LLVM-exception ============================= end_copyright_notice ===========================*/ # TODO: Once upstreamed, update with LLORG revision & adjust per community review diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp index c5c8e880e..791464e8f 100644 --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -1824,10 +1824,13 @@ struct DSEState { ToCheck.insert(Def); ToCheck.insert(Current); // Start at current (1) to simulate already having checked Def. for (unsigned I = 1; I < ToCheck.size(); ++I) { Current = ToCheck[I]; + if (Current == LoadAccess) { + continue; + } if (auto PhiAccess = dyn_cast(Current)) { // Check all the operands. for (auto &Use : PhiAccess->incoming_values()) ToCheck.insert(cast(&Use)); continue;