[llvm-dev] llc -O3 generates basic blocks that end without jump

Alex Susu via llvm-dev llvm-dev at lists.llvm.org
Tue Feb 7 16:16:14 PST 2017

     I noticed that when I pass the -O3 flag to llc some of the resulting ASM basic blocks 
(as seen by the AsmPrinter phase and the resulting .s file) don't contain any jump, be it 
conditional or unconditional. For example I get this ASM .s file after running llc -O3:
       // BB#0:                                // %entry
         mov     r0, 0
         ld_64 r1, ...
         mov     r2, 256
         // Notice there is no jump
       LBB0_1:                                 // %for.cond2.preheader
         mov     r3, 0

     These are not really 2 basic blocks, so the first block without jump should be merged 
with the successor block (if just one successor, which is always the case as far as I can 
see on the tests I ran).

     Did anybody already address such correction of "malformed" basic blocks obtained with 
llc -O3 (or -O1/O2)? Or is there any other flag that I am missing when invoking llc?

   Thank you,

More information about the llvm-dev mailing list