This is an archive of the discontinued LLVM Phabricator instance.

Fix nondeterminism in debuginfo generation
ClosedPublic

Authored by yanok on Nov 9 2021, 12:30 AM.

Details

Summary

Changes from commit 1db137b1859692ae33228c530d4df9f2431b2151
added iteration over hash map that can result in non-deterministic
order. Fix that by using a SmallMapVector to preserve the order.

Diff Detail

Event Timeline

yanok created this revision.Nov 9 2021, 12:30 AM
yanok requested review of this revision.Nov 9 2021, 12:30 AM
Herald added a project: Restricted Project. · View Herald TranscriptNov 9 2021, 12:30 AM
StephenTozer accepted this revision.Nov 9 2021, 1:22 AM
StephenTozer added a subscriber: StephenTozer.

LGTM! Good catch on this one, I thought I'd removed all the DenseMap iteration errors but I guess this one slipped by. There's a small suggestion in the inline comments, but feel free to ignore it - it's more of a preference than a rule. Shouldn't need a test either since this patch is trivial and solves a determinism issue, so this should be fine as-is.

llvm/lib/CodeGen/RegAllocFast.cpp
445–447

Small suggestion - some prefer the above form for brevity, though personally I'm fine with either.

This revision is now accepted and ready to land.Nov 9 2021, 1:22 AM
nikic added a subscriber: nikic.Nov 9 2021, 1:33 AM
nikic added inline comments.
llvm/lib/CodeGen/RegAllocFast.cpp
435

Maybe just switch this to a SmallMapVector?

yanok updated this revision to Diff 385766.Nov 9 2021, 4:06 AM

Just use SmallMapVector as suggested.

yanok edited the summary of this revision. (Show Details)Nov 9 2021, 4:09 AM
yanok added inline comments.Nov 9 2021, 4:13 AM
llvm/lib/CodeGen/RegAllocFast.cpp
435

Yes, that would have the same effect. Thanks for your suggestion, I've modified the patch.

445–447

Thanks for the suggestion, I'll note that. For this specific patch I think switching to SmallMapVector is a simpler way forward though.

This revision was automatically updated to reflect the committed changes.