brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.2 KiB · 703a8cb Raw
114 lines · plain
1; RUN: opt < %s -passes=inline -S | FileCheck %s2; RUN: opt < %s -passes='cgscc(inline)' -S | FileCheck %s3; RUN: opt < %s -passes='module-inline' -S | FileCheck %s4; Test that bar and bar2 are both inlined throughout and removed.5@A = weak global i32 0		; <ptr> [#uses=1]6@B = weak global i32 0		; <ptr> [#uses=1]7@C = weak global i32 0		; <ptr> [#uses=1]8 9define fastcc void @foo(i32 %X) {10entry:11; CHECK-LABEL: @foo(12	%ALL = alloca i32, align 4		; <ptr> [#uses=1]13	%tmp1 = and i32 %X, 1		; <i32> [#uses=1]14	%tmp1.upgrd.1 = icmp eq i32 %tmp1, 0		; <i1> [#uses=1]15	br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true16 17cond_true:		; preds = %entry18	store i32 1, ptr @A19	br label %cond_next20 21cond_next:		; preds = %cond_true, %entry22	%tmp4 = and i32 %X, 2		; <i32> [#uses=1]23	%tmp4.upgrd.2 = icmp eq i32 %tmp4, 0		; <i1> [#uses=1]24	br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true525 26cond_true5:		; preds = %cond_next27	store i32 1, ptr @B28	br label %cond_next729 30cond_next7:		; preds = %cond_true5, %cond_next31	%tmp10 = and i32 %X, 4		; <i32> [#uses=1]32	%tmp10.upgrd.3 = icmp eq i32 %tmp10, 0		; <i1> [#uses=1]33	br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true1134 35cond_true11:		; preds = %cond_next736	store i32 1, ptr @C37	br label %cond_next1338 39cond_next13:		; preds = %cond_true11, %cond_next740	%tmp16 = and i32 %X, 8		; <i32> [#uses=1]41	%tmp16.upgrd.4 = icmp eq i32 %tmp16, 0		; <i1> [#uses=1]42	br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true1743 44cond_true17:		; preds = %cond_next1345	call void @ext( ptr %ALL )46	ret void47 48UnifiedReturnBlock:		; preds = %cond_next1349	ret void50}51 52; CHECK-NOT: @bar(53define internal fastcc void @bar(i32 %X) {54entry:55	%ALL = alloca i32, align 4		; <ptr> [#uses=1]56	%tmp1 = and i32 %X, 1		; <i32> [#uses=1]57	%tmp1.upgrd.1 = icmp eq i32 %tmp1, 0		; <i1> [#uses=1]58	br i1 %tmp1.upgrd.1, label %cond_next, label %cond_true59 60cond_true:		; preds = %entry61	store i32 1, ptr @A62	br label %cond_next63 64cond_next:		; preds = %cond_true, %entry65	%tmp4 = and i32 %X, 2		; <i32> [#uses=1]66	%tmp4.upgrd.2 = icmp eq i32 %tmp4, 0		; <i1> [#uses=1]67	br i1 %tmp4.upgrd.2, label %cond_next7, label %cond_true568 69cond_true5:		; preds = %cond_next70	store i32 1, ptr @B71	br label %cond_next772 73cond_next7:		; preds = %cond_true5, %cond_next74	%tmp10 = and i32 %X, 4		; <i32> [#uses=1]75	%tmp10.upgrd.3 = icmp eq i32 %tmp10, 0		; <i1> [#uses=1]76	br i1 %tmp10.upgrd.3, label %cond_next13, label %cond_true1177 78cond_true11:		; preds = %cond_next779	store i32 1, ptr @C80	br label %cond_next1381 82cond_next13:		; preds = %cond_true11, %cond_next783	%tmp16 = and i32 %X, 8		; <i32> [#uses=1]84	%tmp16.upgrd.4 = icmp eq i32 %tmp16, 0		; <i1> [#uses=1]85	br i1 %tmp16.upgrd.4, label %UnifiedReturnBlock, label %cond_true1786 87cond_true17:		; preds = %cond_next1388	call void @foo( i32 %X )89	ret void90 91UnifiedReturnBlock:		; preds = %cond_next1392	ret void93}94 95define internal fastcc void @bar2(i32 %X) {96entry:97	call void @foo( i32 %X )98	ret void99}100 101declare void @ext(ptr)102 103define void @test(i32 %X) {104entry:105; CHECK: test106; CHECK-NOT: @bar(107	tail call fastcc void @bar( i32 %X )108	tail call fastcc void @bar( i32 %X )109	tail call fastcc void @bar2( i32 %X )110	tail call fastcc void @bar2( i32 %X )111	ret void112; CHECK: ret113}114