Do not schedule BBs before the entry point

Summary:
SPEC CPU2006 perlbench triggered a bug in our heuristic block
reordering algorithm where a hot edge that targets the entry point (as in a
recursive tail call) would make us try to allocate the call site before the
function entry point. Since we don't update function addresses yet, moving the
entry point will corrupt the program. This patch fixes this.

(cherry picked from FBD2562528)
This commit is contained in:
Rafael Auler 2015-10-20 12:30:22 -07:00 committed by Maksim Panchenko
parent b0115a4536
commit 9f41a0d263
1 changed files with 1 additions and 1 deletions

View File

@ -595,7 +595,7 @@ void BinaryFunction::optimizeLayout(bool DumpLayout) {
int I = 0, J = 0;
// Case 1: BBSrc and BBDst are the same. Ignore this edge
if (BBSrc == BBDst)
if (BBSrc == BBDst || BBDst == Entry)
continue;
// Case 2: Both BBSrc and BBDst are already allocated