Skip to content

Commit cfd53ff

Browse files
authored
[InstCombine] Use MapVector for SourceAggregates. (llvm#132564)
foldAggregateConstructionIntoAggregateReuse iterates over the entries of SourceAggregates and the order of inserted instructions depends on the order of the iterator. Using a regular DenseMap can lead to non-deterministic value naming/numbering. I don't think it can actually impact the generated binary, but it makes diffing IR more difficult. PR: llvm#132564
1 parent bcd08f4 commit cfd53ff

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1111,7 +1111,7 @@ Instruction *InstCombinerImpl::foldAggregateConstructionIntoAggregateReuse(
11111111
// For each predecessor, what is the source aggregate,
11121112
// from which all the elements were originally extracted from?
11131113
// Note that we want for the map to have stable iteration order!
1114-
SmallDenseMap<BasicBlock *, Value *, 4> SourceAggregates;
1114+
SmallMapVector<BasicBlock *, Value *, 4> SourceAggregates;
11151115
bool FoundSrcAgg = false;
11161116
for (BasicBlock *Pred : Preds) {
11171117
std::pair<decltype(SourceAggregates)::iterator, bool> IV =

0 commit comments

Comments
 (0)