MachineBlockPlacement pass sets an alignment attribute to the loop header MBB and this attribute will lead to an alignment directive during emitting asm. In the case of the basic block section, the alignment directive is put before the section label, and thus the alignment is set to the predecessor of the loop header, which is not what we expect and increases the code size (both inserting nop and set section alignment).
e.g. reify.__part.2 is the loop header and .p2align 4, 0x90 should be moved below .section .text.reify.reify.__part.2.
.section .text.reify.reify.__part.1,"ax",@progbits reify.__part.1: # %if.end .cfi_startproc .cfi_def_cfa %rsp, 8 movq (%rdi), %rcx movq 24(%rcx), %rdx leaq 1(%rdx), %rax .Ltmp1: #DEBUG_VALUE: reify:key <- $rax cmpq 16(%rcx), %rdx jle reify.__part.3 jmp reify.__part.2 .LBB_END0_1: .size reify.__part.1, .LBB_END0_1-reify.__part.1 .cfi_endproc .p2align 4, 0x90 .section .text.reify.reify.__part.2,"ax",@progbits # .p2align is expected to be put here! reify.__part.2: # %while.body # =>This Inner Loop Header: Depth=1 .cfi_startproc .cfi_def_cfa %rsp, 8
[Nr] Name Type Address Off Size ES Flg Lk Inf Al [ 3] .text.reify PROGBITS 0000000000000000 000040 00000f 00 AX 0 0 16 [ 5] .text.reify.reify.__part.1 PROGBITS 0000000000000000 000050 000020 00 AX 0 0 16 [ 7] .text.reify.reify.__part.2 PROGBITS 0000000000000000 000070 000024 00 AX 0 0 1