1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/X86/basic-block-sections-blockaddress-taken.ll
Sriraman Tallam 7bb78c1965 Basic block sections should enable function sections implicitly.
Basic block sections enables function sections implicitly, this is not needed
and is inefficient with "=list" option.

We had basic block sections enable function sections implicitly in clang. This
is particularly inefficient with "=list" option as it places functions that do
not have any basic block sections in separate sections. This causes unnecessary
object file overhead for large applications.

This patch disables this implicit behavior. It only creates function sections
for those functions that require basic block sections.

Further, there was an inconistent behavior with llc as llc was not turning on
function sections by default. This patch makes llc and clang consistent and
tests are added to check the new behavior.

This is the first of two patches and this adds functionality in LLVM to
create a new section for the entry block if function sections is not
enabled.

Differential Revision: https://reviews.llvm.org/D93876
2021-02-16 16:27:16 -08:00

37 lines
1.1 KiB
LLVM

;; This test verifies that basic-block-sections works with address-taken basic blocks.
; RUN: llc < %s -mtriple=x86_64 -basic-block-sections=all | FileCheck %s
define void @foo(i1 zeroext %0) nounwind {
entry:
%1 = select i1 %0, i8* blockaddress(@foo, %bb1), i8* blockaddress(@foo, %bb2) ; <i8*> [#uses=1]
indirectbr i8* %1, [label %bb1, label %bb2]
; CHECK: .text
; CHECK: .section .text.foo,"ax",@progbits
; CHECK-LABEL: foo:
; CHECK: movl $.Ltmp0, %eax
; CHECK-NEXT: movl $.Ltmp1, %ecx
; CHECK-NEXT: cmovneq %rax, %rcx
; CHECK-NEXT: jmpq *%rcx
bb1: ; preds = %entry
%2 = call i32 @bar()
ret void
; CHECK: .section .text.foo,"ax",@progbits,unique,1
; CHECK-NEXT: .Ltmp0:
; CHECK-NEXT: foo.__part.1
; CHECK-NEXT: callq bar
;
bb2: ; preds = %entry
%3 = call i32 @baz()
ret void
; CHECK: .section .text.foo,"ax",@progbits,unique,2
; CHECK-NEXT: .Ltmp1:
; CHECK-NEXT: foo.__part.2
; CHECK-NEXT: callq baz
}
declare i32 @bar()
declare i32 @baz()