brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.3 KiB · b463454 Raw
66 lines · plain
1; BB cluster sections test for optimizing basic block branches.2;3; Test1: Basic blocks #0 (entry) and #2 will be placed in the same section.4; There should be a jne from #0 to #1 and a fallthrough to #2.5; BB #1 will be in a unique section. Therefore, it should retain its jmp to #3.6; #2 must also have an explicit jump to #3.7; RUN: echo '!foo' > %t18; RUN: echo '!!0 2' >> %t19; RUN: echo '!!1' >> %t110; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t1 | FileCheck %s -check-prefix=LINUX-SECTIONS111;12; Test2: Basic blocks #1 and #3 will be placed in the same section.13; The rest (#0 and #2) go into the function's section.14; This means #1 must fall through to #3, and #0 must fall through to #2.15; #2 must have an explicit jump to #3.16; RUN: echo '!foo' > %t217; RUN: echo '!!1 3' >> %t218; RUN: llc < %s -O0 -mtriple=x86_64-pc-linux -function-sections -basic-block-sections=%t2 | FileCheck %s -check-prefix=LINUX-SECTIONS219 20define void @foo(i1 zeroext) nounwind {21  %2 = alloca i8, align 122  %3 = zext i1 %0 to i823  store i8 %3, ptr %2, align 124  %4 = load i8, ptr %2, align 125  %5 = trunc i8 %4 to i126  br i1 %5, label %6, label %827 286:                                                ; preds = %129  %7 = call i32 @bar()30  br label %1031 328:                                                ; preds = %133  %9 = call i32 @baz()34  br label %1035 3610:                                               ; preds = %8, %637  ret void38}39 40declare i32 @bar() #141 42declare i32 @baz() #143 44; LINUX-SECTIONS1:	   	.section	.text.foo,"ax",@progbits45; LINUX-SECTIONS1-LABEL:	foo:46; LINUX-SECTIONS1:		jne foo.__part.147; LINUX-SECTIONS1-NOT:		{{jne|je|jmp}}48; LINUX-SECTIONS1-LABEL:	# %bb.2:49; LINUX-SECTIONS1:		jmp foo.cold50; LINUX-SECTIONS1:		.section        .text.foo,"ax",@progbits,unique,151; LINUX-SECTIONS1-LABEL:	foo.__part.1:52; LINUX-SECTIONS1:		jmp foo.cold53; LINUX-SECTIONS1:		.section        .text.split.foo,"ax",@progbits54; LINUX-SECTIONS1-LABEL:	foo.cold:55 56; LINUX-SECTIONS2:		.section        .text.foo,"ax",@progbits57; LINUX-SECTIONS2-LABEL:	foo:58; LINUX-SECTIONS2:		jne foo.__part.059; LINUX-SECTIONS2-NOT:		{{jne|je|jmp}}60; LINUX-SECTIONS2-LABEL:	# %bb.2:61; LINUX-SECTIONS2:		jmp .LBB0_362; LINUX-SECTIONS2:		.section        .text.foo,"ax",@progbits,unique,163; LINUX-SECTIONS2:		foo.__part.0:64; LINUX-SECTIONS2-NOT:		{{jne|je|jmp}}65; LINUX-SECTIONS2:		.LBB0_3:66