Page MenuHomePhabricator

[ConstantHoisting] Fix non-determinism.
Needs ReviewPublic

Authored by efriedma on Mon, Aug 12, 3:17 PM.

Details

Reviewers
spatel
wmi

Diff Detail

Repository
rL LLVM

Event Timeline

efriedma created this revision.Mon, Aug 12, 3:17 PM
Herald added a project: Restricted Project. · View Herald TranscriptMon, Aug 12, 3:17 PM
Herald added a subscriber: mgrang. · View Herald Transcript

Have you tried measuring compile-time on some benchmark with this patch. Changing unordered containers to ordered ones can increase compile-time. What if you simply sort the containers before iteration?

The keys are subclasses of llvm::Value, so sorting is hard. There's no obvious comparator to sort global variables. Instructions and basic blocks could be sorted based on DFS numbers, or something like that, but it would be a lot more complicated.

Looking again, a couple of these might not actually need to be ordered; in particular, BBs, and ConstCandMap. I'll spend a bit more time to try and verify that.