diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp --- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -2417,7 +2417,8 @@ // adding them to a worklist. Bail when we run into a memory def that // does not match LoadAccess. SetVector ToCheck; - MemoryAccess *Current = Def->getDefiningAccess(); + MemoryAccess *Current = + MSSA.getWalker()->getClobberingMemoryAccess(Def); // We don't want to bail when we run into the store memory def. But, // the phi access may point to it. So, pretend like we've already // checked it. diff --git a/llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll b/llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll --- a/llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll +++ b/llvm/test/Transforms/DeadStoreElimination/MSSA/noop-stores.ll @@ -15,7 +15,6 @@ define void @test_load_volatile(i32* %Q) { ; CHECK-LABEL: @test_load_volatile( ; CHECK-NEXT: [[A:%.*]] = load volatile i32, i32* [[Q:%.*]], align 4 -; CHECK-NEXT: store i32 [[A]], i32* [[Q]], align 4 ; CHECK-NEXT: ret void ; %a = load volatile i32, i32* %Q @@ -284,9 +283,7 @@ define void @test_noalias_store_between_load_and_store(i32* noalias %x, i32* noalias %y) { ; CHECK-LABEL: @test_noalias_store_between_load_and_store( ; CHECK-NEXT: entry: -; CHECK-NEXT: [[LV:%.*]] = load i32, i32* [[X:%.*]], align 4 ; CHECK-NEXT: store i32 0, i32* [[Y:%.*]], align 4 -; CHECK-NEXT: store i32 [[LV]], i32* [[X]], align 4 ; CHECK-NEXT: ret void ; entry: