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-after=bbsections-prepare %s -o - | FileCheck %s -check-prefix=CHECK 3 4# How to generate the input: 5# foo.c 6# 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.c 21# llc < test.ll -stop-after=bbsections-prepare -align-all-nofallthru-blocks=8 -basic-block-sections=all 22 23 24--- | 25 define i32 @test(i32 noundef %a) { 26 entry: 27 switch i32 %a, label %return [ 28 i32 1, label %sw.bb1 29 i32 2, label %sw.bb1 30 i32 8, label %sw.epilog 31 ] 32 33 sw.bb1: ; preds = %entry, %entry 34 br label %sw.epilog 35 36 sw.epilog: ; preds = %sw.bb1, %entry 37 %a.addr.1 = phi i32 [ %a, %entry ], [ -2, %sw.bb1 ] 38 br label %return 39 40 return: ; preds = %sw.epilog, %entry 41 %retval.0 = phi i32 [ %a.addr.1, %sw.epilog ], [ 10, %entry ] 42 ret i32 %retval.0 43 } 44 45 46... 47--- 48name: test 49alignment: 16 50exposesReturnsTwice: false 51legalized: false 52regBankSelected: false 53selected: false 54failedISel: false 55tracksRegLiveness: true 56hasWinCFI: false 57callsEHReturn: false 58callsUnwindInit: false 59hasEHCatchret: false 60hasEHScopes: false 61hasEHFunclets: false 62failsVerification: false 63tracksDebugUserValues: true 64registers: [] 65liveins: 66 - { reg: '$edi', virtual-reg: '' } 67frameInfo: 68 isFrameAddressTaken: false 69 isReturnAddressTaken: false 70 hasStackMap: false 71 hasPatchPoint: false 72 stackSize: 0 73 offsetAdjustment: 0 74 maxAlignment: 1 75 adjustsStack: false 76 hasCalls: false 77 stackProtector: '' 78 functionContext: '' 79 maxCallFrameSize: 0 80 cvBytesOfCalleeSavedRegisters: 0 81 hasOpaqueSPAdjustment: false 82 hasVAStart: false 83 hasMustTailInVarArgFunc: false 84 hasTailCall: false 85 localFrameSize: 0 86 savePoint: '' 87 restorePoint: '' 88fixedStack: [] 89stack: [] 90callSites: [] 91debugValueSubstitutions: [] 92constants: [] 93machineFunctionInfo: {} 94body: | 95 bb.0.entry: 96 successors: %bb.1(0x40000000), %bb.2(0x40000000) 97 liveins: $edi 98 99 renamable $edi = KILL $edi, implicit-def $rdi 100 renamable $eax = LEA64_32r renamable $rdi, 1, $noreg, -1, $noreg 101 CMP32ri8 killed renamable $eax, 2, implicit-def $eflags 102 JCC_1 %bb.2, 3, implicit $eflags 103 JMP_1 %bb.1 104 105 bb.1.sw.bb1 (bbsections 1): 106 successors: %bb.3(0x80000000) 107 108 renamable $edi = MOV32ri -2, implicit-def $rdi 109 JMP_1 %bb.3 110 111 bb.2.entry (align 256, bbsections 2): 112 successors: %bb.3(0x40000000), %bb.4(0x40000000) 113 liveins: $rdi 114 115 renamable $eax = MOV32ri 10 116 CMP32ri8 renamable $edi, 8, implicit-def $eflags 117 JCC_1 %bb.4, 5, implicit $eflags 118 JMP_1 %bb.3 119 120 bb.3.sw.epilog (bbsections 3): 121 successors: %bb.4(0x80000000) 122 liveins: $rdi 123 124 $eax = MOV32rr $edi, implicit killed $rdi 125 JMP_1 %bb.4 126 127 bb.4.return (bbsections 4): 128 liveins: $eax 129 130 RET64 $eax 131 132... 133 134# CHECK: .section .text.test,"ax",@progbits,unique,2 135# CHECK-NEXT: .p2align 8 136# CHECK-NEXT: test.__part.2: # %entry 137