From 9f41a0d26385b1177691a89ff7e948aaa195150b Mon Sep 17 00:00:00 2001 From: Rafael Auler Date: Tue, 20 Oct 2015 12:30:22 -0700 Subject: [PATCH] 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) --- bolt/BinaryFunction.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bolt/BinaryFunction.cpp b/bolt/BinaryFunction.cpp index 079b0ed2e2fd..0c1d61918530 100644 --- a/bolt/BinaryFunction.cpp +++ b/bolt/BinaryFunction.cpp @@ -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