This is an archive of the discontinued LLVM Phabricator instance.

[PGO] Fixed non-determinism with DenseSet storing function importing info.
ClosedPublic

Authored by apazos on Aug 28 2017, 8:25 PM.

Details

Summary

r296498 introduced a DenseSet to store function importing info.

Using this container causes a test failure in
test/Transform/SampleProfile/import.ll when in Reverse Iteration mode.

This patch orders IDs before iterating through this container.

Diff Detail

Event Timeline

apazos created this revision.Aug 28 2017, 8:25 PM
danielcdh edited edge metadata.Aug 28 2017, 9:13 PM

does this change any tests?

lib/IR/MDBuilder.cpp
77

please remove this line

No, no test needs to change.

After r296498 change the compiler was generating:
!35 = !{!"function_entry_count", i64 1, i64 -2012135647395072713, i64 6699318081062747564}

While the test expected:
!35 = !{!"function_entry_count", i64 1, i64 6699318081062747564, i64 -2012135647395072713}

In regular mode, the test passes. But it failed in Reverse Iteration mode.

apazos updated this revision to Diff 113104.Aug 29 2017, 9:19 AM
apazos edited the summary of this revision. (Show Details)

Removed empty line.

danielcdh accepted this revision.Aug 29 2017, 9:21 AM

The sorting is not a concern as it's only called once perf function, and the list should not be large.

Thanks for fixing the non-determinism in code.

This revision is now accepted and ready to land.Aug 29 2017, 9:21 AM
This revision was automatically updated to reflect the committed changes.