Eric Christopher | cee313d | 2019-04-17 04:52:47 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -partial-inliner -S -stats -pass-remarks=partial-inlining 2>&1 | FileCheck %s |
| 2 | ; RUN: opt < %s -passes=partial-inliner -S -stats -pass-remarks=partial-inlining 2>&1 | FileCheck %s |
| 3 | |
| 4 | @stat = external global i32, align 4 |
| 5 | |
| 6 | define i32 @inline_fail(i32 %count, ...) { |
| 7 | entry: |
| 8 | %vargs = alloca i8*, align 8 |
| 9 | %vargs1 = bitcast i8** %vargs to i8* |
| 10 | call void @llvm.va_start(i8* %vargs1) |
| 11 | %stat1 = load i32, i32* @stat, align 4 |
| 12 | %cmp = icmp slt i32 %stat1, 0 |
| 13 | br i1 %cmp, label %bb2, label %bb1 |
| 14 | |
| 15 | bb1: ; preds = %entry |
| 16 | %vg1 = add nsw i32 %stat1, 1 |
| 17 | store i32 %vg1, i32* @stat, align 4 |
| 18 | %va1 = va_arg i8** %vargs, i32 |
| 19 | call void @foo(i32 %count, i32 %va1) #2 |
| 20 | br label %bb2 |
| 21 | |
| 22 | bb2: ; preds = %bb1, %entry |
| 23 | %res = phi i32 [ 1, %bb1 ], [ 0, %entry ] |
| 24 | call void @llvm.va_end(i8* %vargs1) |
| 25 | ret i32 %res |
| 26 | } |
| 27 | |
| 28 | define i32 @caller(i32 %arg) { |
| 29 | bb: |
| 30 | %res = tail call i32 (i32, ...) @inline_fail(i32 %arg, i32 %arg) |
| 31 | ret i32 %res |
| 32 | } |
| 33 | |
| 34 | declare void @foo(i32, i32) |
| 35 | declare void @llvm.va_start(i8*) |
| 36 | declare void @llvm.va_end(i8*) |
| 37 | |
| 38 | ; Check that no remarks have been emitted, inline_fail has not been partial |
| 39 | ; inlined, no code has been extracted and the partial-inlining counter |
| 40 | ; has not been incremented. |
| 41 | |
| 42 | ; CHECK-NOT: remark |
| 43 | ; CHECK: tail call i32 (i32, ...) @inline_fail(i32 %arg, i32 %arg) |
| 44 | ; CHECK-NOT: inline_fail.1_bb1 |
| 45 | ; CHECK-NOT: partial-inlining |