--- old/src/share/vm/opto/block.cpp 2016-04-13 12:47:35.144513895 +0200 +++ new/src/share/vm/opto/block.cpp 2016-04-13 12:47:34.369517151 +0200 @@ -72,7 +72,7 @@ } #endif -uint Block::code_alignment() { +uint Block::code_alignment() const { // Check for Root block if (_pre_order == 0) return CodeEntryAlignment; // Check for Start block @@ -1726,8 +1726,22 @@ first_block()->set_loop_alignment(targ_block); } else { - // Backbranch into the middle of a trace - targ_block->set_loop_alignment(targ_block); + // That loop may already have a loop top (we're reaching it again + // through the backedge of an outer loop) + bool has_top = false; + for (Block* b = prev(targ_block); b != NULL; b = prev(b)) { + if (b->head()->is_Loop()) { + break; + } + if (b->has_loop_alignment()) { + has_top = true; + break; + } + } + if (!has_top) { + // Backbranch into the middle of a trace + targ_block->set_loop_alignment(targ_block); + } } return loop_rotated; --- old/src/share/vm/opto/block.hpp 2016-04-13 12:47:36.193509488 +0200 +++ new/src/share/vm/opto/block.hpp 2016-04-13 12:47:35.415512756 +0200 @@ -197,7 +197,7 @@ // Report the alignment required by this block. Must be a power of 2. // The previous block will insert nops to get this alignment. - uint code_alignment(); + uint code_alignment() const; uint compute_loop_alignment(); // BLOCK_FREQUENCY is a sentinel to mark uses of constant block frequencies. --- old/src/share/vm/opto/c2_globals.hpp 2016-04-13 12:47:37.176505357 +0200 +++ new/src/share/vm/opto/c2_globals.hpp 2016-04-13 12:47:36.435508470 +0200 @@ -587,7 +587,7 @@ range(0, 100) \ \ product(bool, BlockLayoutRotateLoops, true, \ - "Allow back branches to be fall throughs in the block layour") \ + "Allow back branches to be fall throughs in the block layout") \ \ diagnostic(bool, InlineReflectionGetCallerClass, true, \ "inline sun.reflect.Reflection.getCallerClass(), known to be " \