Rafael Espindola | 1c99344 | 2014-11-06 15:05:51 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s -enable-tail-merge | FileCheck %s |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 2 | ; Check that calls to baz and quux are tail-merged. |
Duncan Sands | 6820abe | 2007-09-05 11:53:04 +0000 | [diff] [blame] | 3 | ; PR1628 |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 4 | |
Rafael Espindola | 1c99344 | 2014-11-06 15:05:51 +0000 | [diff] [blame] | 5 | ; CHECK: bl _baz |
| 6 | ; CHECK-NOT: bl _baz |
| 7 | ; CHECK: bl _quux |
| 8 | ; CHECK-NOT: bl _quux |
| 9 | |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 10 | ; ModuleID = 'tail.c' |
Rafael Espindola | 1c99344 | 2014-11-06 15:05:51 +0000 | [diff] [blame] | 11 | target triple = "arm-apple-darwin8" |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 12 | |
| 13 | define i32 @f(i32 %i, i32 %q) { |
| 14 | entry: |
| 15 | %i_addr = alloca i32 ; <i32*> [#uses=2] |
| 16 | %q_addr = alloca i32 ; <i32*> [#uses=2] |
| 17 | %retval = alloca i32, align 4 ; <i32*> [#uses=1] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 18 | store i32 %i, i32* %i_addr |
| 19 | store i32 %q, i32* %q_addr |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 20 | %tmp = load i32, i32* %i_addr ; <i32> [#uses=1] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 21 | %tmp1 = icmp ne i32 %tmp, 0 ; <i1> [#uses=1] |
| 22 | %tmp12 = zext i1 %tmp1 to i8 ; <i8> [#uses=1] |
| 23 | %toBool = icmp ne i8 %tmp12, 0 ; <i1> [#uses=1] |
| 24 | br i1 %toBool, label %cond_true, label %cond_false |
| 25 | |
| 26 | cond_true: ; preds = %entry |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 27 | %tmp3 = call i32 (...) @bar( ) ; <i32> [#uses=0] |
| 28 | %tmp4 = call i32 (...) @baz( i32 5, i32 6 ) ; <i32> [#uses=0] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 29 | br label %cond_next |
| 30 | |
| 31 | cond_false: ; preds = %entry |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 32 | %tmp5 = call i32 (...) @foo( ) ; <i32> [#uses=0] |
| 33 | %tmp6 = call i32 (...) @baz( i32 5, i32 6 ) ; <i32> [#uses=0] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 34 | br label %cond_next |
| 35 | |
| 36 | cond_next: ; preds = %cond_false, %cond_true |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 37 | %tmp7 = load i32, i32* %q_addr ; <i32> [#uses=1] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 38 | %tmp8 = icmp ne i32 %tmp7, 0 ; <i1> [#uses=1] |
| 39 | %tmp89 = zext i1 %tmp8 to i8 ; <i8> [#uses=1] |
| 40 | %toBool10 = icmp ne i8 %tmp89, 0 ; <i1> [#uses=1] |
| 41 | br i1 %toBool10, label %cond_true11, label %cond_false15 |
| 42 | |
| 43 | cond_true11: ; preds = %cond_next |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 44 | %tmp13 = call i32 (...) @foo( ) ; <i32> [#uses=0] |
| 45 | %tmp14 = call i32 (...) @quux( i32 3, i32 4 ) ; <i32> [#uses=0] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 46 | br label %cond_next18 |
| 47 | |
| 48 | cond_false15: ; preds = %cond_next |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 49 | %tmp16 = call i32 (...) @bar( ) ; <i32> [#uses=0] |
| 50 | %tmp17 = call i32 (...) @quux( i32 3, i32 4 ) ; <i32> [#uses=0] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 51 | br label %cond_next18 |
| 52 | |
| 53 | cond_next18: ; preds = %cond_false15, %cond_true11 |
David Blaikie | 23af648 | 2015-04-16 23:24:18 +0000 | [diff] [blame] | 54 | %tmp19 = call i32 (...) @bar( ) ; <i32> [#uses=0] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 55 | br label %return |
| 56 | |
| 57 | return: ; preds = %cond_next18 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 58 | %retval20 = load i32, i32* %retval ; <i32> [#uses=1] |
Chris Lattner | 4ef41c1 | 2007-05-08 02:19:56 +0000 | [diff] [blame] | 59 | ret i32 %retval20 |
| 60 | } |
| 61 | |
| 62 | declare i32 @bar(...) |
| 63 | |
| 64 | declare i32 @baz(...) |
| 65 | |
| 66 | declare i32 @foo(...) |
| 67 | |
| 68 | declare i32 @quux(...) |