| 1 |
/*========================== begin_copyright_notice ============================ |
| 2 |
|
| 3 |
Copyright (C) 2023-2024 Intel Corporation |
| 4 |
|
| 5 |
SPDX-License-Identifier: MIT |
| 6 |
|
| 7 |
============================= end_copyright_notice ===========================*/ |
| 8 |
|
| 9 |
/*========================== begin_copyright_notice ============================ |
| 10 |
|
| 11 |
Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
| 12 |
See https://llvm.org/LICENSE.txt for license information. |
| 13 |
SPDX-License-Identifier: Apache-2.0 with LLVM-exception |
| 14 |
|
| 15 |
============================= end_copyright_notice ===========================*/ |
| 16 |
|
| 17 |
# TODO: Once upstreamed, update with LLORG revision & adjust per community review |
| 18 |
|
| 19 |
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp |
| 20 |
index c5c8e880e..791464e8f 100644 |
| 21 |
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp |
| 22 |
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp |
| 23 |
@@ -1824,10 +1824,13 @@ struct DSEState { |
| 24 |
ToCheck.insert(Def); |
| 25 |
ToCheck.insert(Current); |
| 26 |
// Start at current (1) to simulate already having checked Def. |
| 27 |
for (unsigned I = 1; I < ToCheck.size(); ++I) { |
| 28 |
Current = ToCheck[I]; |
| 29 |
+ if (Current == LoadAccess) { |
| 30 |
+ continue; |
| 31 |
+ } |
| 32 |
if (auto PhiAccess = dyn_cast<MemoryPhi>(Current)) { |
| 33 |
// Check all the operands. |
| 34 |
for (auto &Use : PhiAccess->incoming_values()) |
| 35 |
ToCheck.insert(cast<MemoryAccess>(&Use)); |
| 36 |
continue; |