[llvm] [DSE] Make iter order deterministic in removePartiallyOverlappedStores. NFC (PR #127678)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 18 10:26:17 PST 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-llvm-transforms
Author: Björn Pettersson (bjope)
<details>
<summary>Changes</summary>
In removePartiallyOverlappedStores we iterate over InstOverlapIntervalsTy which is a DenseMap. Change that map into using MapVector to ensure that we apply the transforms in a deterministic order. I've only seen that the order matters if starting to use names for the instructions created when doing the transforms. But such things are a bit annoying when debugging etc.
---
Full diff: https://github.com/llvm/llvm-project/pull/127678.diff
1 Files Affected:
- (modified) llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp (+1-1)
``````````diff
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index a1649c276de83..f3b53e05c519e 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -174,7 +174,7 @@ static cl::opt<bool> EnableInitializesImprovement(
// Helper functions
//===----------------------------------------------------------------------===//
using OverlapIntervalsTy = std::map<int64_t, int64_t>;
-using InstOverlapIntervalsTy = DenseMap<Instruction *, OverlapIntervalsTy>;
+using InstOverlapIntervalsTy = MapVector<Instruction *, OverlapIntervalsTy>;
/// Returns true if the end of this instruction can be safely shortened in
/// length.
``````````
</details>
https://github.com/llvm/llvm-project/pull/127678
More information about the llvm-commits
mailing list