1# REQUIRES: asserts 2# RUN: llc -mtriple=aarch64--linux-gnu -run-pass=branch-relaxation -debug-only=branch-relaxation %s -o /dev/null 2>&1 | FileCheck %s 3 4# Ensure meta instructions (e.g. CFI_INSTRUCTION) don't contribute to the code 5# size of a basic block. 6 7# CHECK: Basic blocks before relaxation 8# CHECK-NEXT: %bb.0 offset=00000000 size=0x18 9# CHECK-NEXT: %bb.1 offset=00000018 size=0x4 10# CHECK-NEXT: %bb.2 offset=0000001c size=0xc 11 12--- | 13 target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128" 14 target triple = "aarch64--linux-gnu" 15 16 define i32 @test(i32* %a) #0 { 17 entry: 18 %call = tail call i32 @validate(i32* %a) 19 %tobool = icmp eq i32 %call, 0 20 br i1 %tobool, label %return, label %if.then 21 22 if.then: ; preds = %entry 23 %0 = load i32, i32* %a, align 4 24 br label %return 25 26 return: ; preds = %entry, %if.then 27 %retval.0 = phi i32 [ %0, %if.then ], [ 0, %entry ] 28 ret i32 %retval.0 29 } 30 31 declare i32 @validate(i32*) 32 33 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "frame-pointer"="all" } 34 35... 36--- 37name: test 38alignment: 4 39tracksRegLiveness: true 40liveins: 41 - { reg: '$x0' } 42frameInfo: 43 stackSize: 32 44 maxAlignment: 16 45 adjustsStack: true 46 hasCalls: true 47 maxCallFrameSize: 0 48stack: 49 - { id: 0, type: spill-slot, offset: -8, size: 8, alignment: 8, callee-saved-register: '$lr' } 50 - { id: 1, type: spill-slot, offset: -16, size: 8, alignment: 8, callee-saved-register: '$fp' } 51 - { id: 2, type: spill-slot, offset: -32, size: 8, alignment: 16, callee-saved-register: '$x19' } 52body: | 53 bb.0.entry: 54 successors: %bb.2(0x30000000), %bb.1(0x50000000) 55 liveins: $x0, $x19, $lr 56 57 early-clobber $sp = frame-setup STRXpre killed $x19, $sp, -32 :: (store 8 into %stack.2) 58 frame-setup STPXi $fp, killed $lr, $sp, 2 :: (store 8 into %stack.1), (store 8 into %stack.0) 59 $fp = frame-setup ADDXri $sp, 16, 0 60 frame-setup CFI_INSTRUCTION def_cfa $w29, 16 61 frame-setup CFI_INSTRUCTION offset $w30, -8 62 frame-setup CFI_INSTRUCTION offset $w29, -16 63 frame-setup CFI_INSTRUCTION offset $w19, -32 64 $x19 = ORRXrs $xzr, $x0, 0 65 BL @validate, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit killed $x0, implicit-def $sp, implicit-def $w0 66 CBZW renamable $w0, %bb.2 67 68 bb.1.if.then: 69 liveins: $x19 70 71 renamable $w0 = LDRWui killed renamable $x19, 0 :: (load 4 from %ir.a) 72 73 bb.2.return: 74 liveins: $w0 75 76 $fp, $lr = frame-destroy LDPXi $sp, 2 :: (load 8 from %stack.1), (load 8 from %stack.0) 77 early-clobber $sp, $x19 = frame-destroy LDRXpost $sp, 32 :: (load 8 from %stack.2) 78 RET undef $lr, implicit killed $w0 79 80... 81