137 lines · plain
1# Check if the alignment directive is put on the correct place when the basic block section option is used.2# RUN: llc -mtriple x86_64-unknown-linux-gnu -start-before=x86-asm-printer %s -o - | FileCheck %s -check-prefix=CHECK3 4# How to generate the input:5# foo.c6# int test(int a) {7# switch (a) {8# default:9# return 10;10# case 1:11# a += 1;12# case 2:13# a *= -1;14# case 8:15# break;16# }17# return a;18# }19#20# clang -O0 -S -emit-llvm test.c21# llc < test.ll -stop-after=bbsections-prepare -align-all-nofallthru-blocks=8 -basic-block-sections=all22 23 24--- |25 define i32 @test(i32 noundef %a) {26 entry:27 switch i32 %a, label %return [28 i32 1, label %sw.bb129 i32 2, label %sw.bb130 i32 8, label %sw.epilog31 ]32 33 sw.bb1: ; preds = %entry, %entry34 br label %sw.epilog35 36 sw.epilog: ; preds = %sw.bb1, %entry37 %a.addr.1 = phi i32 [ %a, %entry ], [ -2, %sw.bb1 ]38 br label %return39 40 return: ; preds = %sw.epilog, %entry41 %retval.0 = phi i32 [ %a.addr.1, %sw.epilog ], [ 10, %entry ]42 ret i32 %retval.043 }44 45 46...47---48name: test49alignment: 1650exposesReturnsTwice: false51legalized: false52regBankSelected: false53selected: false54failedISel: false55tracksRegLiveness: true56hasWinCFI: false57callsEHReturn: false58callsUnwindInit: false59hasEHContTarget: false60hasEHScopes: false61hasEHFunclets: false62failsVerification: false63tracksDebugUserValues: true64registers: []65liveins:66 - { reg: '$edi', virtual-reg: '' }67frameInfo:68 isFrameAddressTaken: false69 isReturnAddressTaken: false70 hasStackMap: false71 hasPatchPoint: false72 stackSize: 073 offsetAdjustment: 074 maxAlignment: 175 adjustsStack: false76 hasCalls: false77 stackProtector: ''78 functionContext: ''79 maxCallFrameSize: 080 cvBytesOfCalleeSavedRegisters: 081 hasOpaqueSPAdjustment: false82 hasVAStart: false83 hasMustTailInVarArgFunc: false84 hasTailCall: false85 localFrameSize: 086 savePoint: []87 restorePoint: []88fixedStack: []89stack: []90callSites: []91debugValueSubstitutions: []92constants: []93machineFunctionInfo: {}94body: |95 bb.0.entry:96 successors: %bb.1(0x40000000), %bb.2(0x40000000)97 liveins: $edi98 99 renamable $edi = KILL $edi, implicit-def $rdi100 renamable $eax = LEA64_32r renamable $rdi, 1, $noreg, -1, $noreg101 CMP32ri8 killed renamable $eax, 2, implicit-def $eflags102 JCC_1 %bb.2, 3, implicit $eflags103 JMP_1 %bb.1104 105 bb.1.sw.bb1 (bbsections 1):106 successors: %bb.3(0x80000000)107 108 renamable $edi = MOV32ri -2, implicit-def $rdi109 JMP_1 %bb.3110 111 bb.2.entry (align 256, bbsections 2):112 successors: %bb.3(0x40000000), %bb.4(0x40000000)113 liveins: $rdi114 115 renamable $eax = MOV32ri 10116 CMP32ri8 renamable $edi, 8, implicit-def $eflags117 JCC_1 %bb.4, 5, implicit $eflags118 JMP_1 %bb.3119 120 bb.3.sw.epilog (bbsections 3):121 successors: %bb.4(0x80000000)122 liveins: $rdi123 124 $eax = MOV32rr $edi, implicit killed $rdi125 JMP_1 %bb.4126 127 bb.4.return (bbsections 4):128 liveins: $eax129 130 RET64 $eax131 132...133 134# CHECK: .section .text.test,"ax",@progbits,unique,2135# CHECK-NEXT: .p2align 8136# CHECK-NEXT: test.__part.2: # %entry137