| Paul Robinson | d89125a | 2013-11-22 19:11:24 +0000 | [diff] [blame] | 1 | ; RUN: llc -O2 -march=x86 < %s | FileCheck %s |
| 2 | |
| 3 | define i32* @fooOptnone(i32* %p, i32* %q, i32** %z) #0 { |
| 4 | entry: |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 5 | %r = load i32, i32* %p |
| 6 | %s = load i32, i32* %q |
| 7 | %y = load i32*, i32** %z |
| Paul Robinson | d89125a | 2013-11-22 19:11:24 +0000 | [diff] [blame] | 8 | |
| 9 | %t0 = add i32 %r, %s |
| 10 | %t1 = add i32 %t0, 1 |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 11 | %t2 = getelementptr i32, i32* %y, i32 1 |
| 12 | %t3 = getelementptr i32, i32* %t2, i32 %t1 |
| Paul Robinson | d89125a | 2013-11-22 19:11:24 +0000 | [diff] [blame] | 13 | |
| 14 | ret i32* %t3 |
| 15 | |
| 16 | ; 'optnone' should use fast-isel which will not produce 'lea'. |
| 17 | ; CHECK-LABEL: fooOptnone: |
| 18 | ; CHECK-NOT: lea |
| 19 | ; CHECK: ret |
| 20 | } |
| 21 | |
| 22 | define i32* @fooNormal(i32* %p, i32* %q, i32** %z) #1 { |
| 23 | entry: |
| David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 24 | %r = load i32, i32* %p |
| 25 | %s = load i32, i32* %q |
| 26 | %y = load i32*, i32** %z |
| Paul Robinson | d89125a | 2013-11-22 19:11:24 +0000 | [diff] [blame] | 27 | |
| 28 | %t0 = add i32 %r, %s |
| 29 | %t1 = add i32 %t0, 1 |
| David Blaikie | 79e6c74 | 2015-02-27 19:29:02 +0000 | [diff] [blame] | 30 | %t2 = getelementptr i32, i32* %y, i32 1 |
| 31 | %t3 = getelementptr i32, i32* %t2, i32 %t1 |
| Paul Robinson | d89125a | 2013-11-22 19:11:24 +0000 | [diff] [blame] | 32 | |
| 33 | ret i32* %t3 |
| 34 | |
| 35 | ; Normal ISel will produce 'lea'. |
| 36 | ; CHECK-LABEL: fooNormal: |
| 37 | ; CHECK: lea |
| 38 | ; CHECK: ret |
| 39 | } |
| 40 | |
| 41 | attributes #0 = { nounwind optnone noinline } |
| 42 | attributes #1 = { nounwind } |