This is an archive of the discontinued LLVM Phabricator instance.

CodeGen: BlockPlacement: Clear ComputedEdges between functions.
ClosedPublic

Authored by iteratee on Apr 11 2017, 5:26 PM.

Details

Summary

Not clearing was causing non-deterministic compiles for large files. Addresses
for MachineBasicBlocks would end up colliding and we would lay out a block that
we assumed had been pre-computed when it had not been.

Diff Detail

Event Timeline

iteratee created this revision.Apr 11 2017, 5:26 PM
chandlerc accepted this revision.Apr 11 2017, 6:29 PM

LGTM. Also, this is clearly correct, feel free to land this simple of bug fix directly. =]

It'd be great if you can come up with a test with a pile of functions that will trigger this, but I understand why that might be hard. The assert seems likely enough.

This revision is now accepted and ready to land.Apr 11 2017, 6:29 PM
Gerolf requested changes to this revision.Apr 12 2017, 3:51 PM
Gerolf added a subscriber: Gerolf.

Please double check your code one more time. Thank you!

-Gerolf

lib/CodeGen/MachineBlockPlacement.cpp
2675 ↗(On Diff #94910)

I think you need to clear ComptedEdges here for the same reason you clear BlockToChain.

This revision now requires changes to proceed.Apr 12 2017, 3:51 PM
iteratee accepted this revision.May 2 2017, 4:39 PM

I found the bugs mentioned via my own testing.

iteratee updated this revision to Diff 97524.May 2 2017, 4:41 PM
iteratee edited edge metadata.

Already committed in rL300022

iteratee marked an inline comment as done.May 2 2017, 4:42 PM

Gerolf if you could accept this so I can close it, I would appreciate it.

iteratee removed a reviewer: Gerolf.May 2 2017, 4:43 PM
This revision is now accepted and ready to land.May 2 2017, 4:43 PM
iteratee resigned from this revision.May 2 2017, 4:43 PM
iteratee closed this revision.

Committed in rL300022. The committed version contained a fix for the error Gerolf spotted.

Thanks, Kyle!

echristo added inline comments.May 4 2017, 9:42 PM
llvm/trunk/lib/CodeGen/MachineBlockPlacement.cpp
2643

Drive-by nit: Typically we like to have some text in the assert as well to explain why we're checking for such a thing, e.g. assert(BlockToChain.empty() && "Forgot to clear BlockToChain between functions!") or something.