Bill Wendling | d5cc8b8 | 2012-04-24 09:15:38 +0000 | [diff] [blame] | 1 | ; RUN: opt < %s -basicaa -gvn -instcombine -S | FileCheck %s |
Nick Lewycky | f23d0d3 | 2008-12-19 06:39:12 +0000 | [diff] [blame] | 2 | |
| 3 | declare i32* @test(i32* nocapture) |
| 4 | |
| 5 | define i32 @test2() { |
Bill Wendling | d5cc8b8 | 2012-04-24 09:15:38 +0000 | [diff] [blame] | 6 | ; CHECK: ret i32 0 |
Nick Lewycky | f23d0d3 | 2008-12-19 06:39:12 +0000 | [diff] [blame] | 7 | %P = alloca i32 |
| 8 | %Q = call i32* @test(i32* %P) |
| 9 | %a = load i32* %P |
| 10 | store i32 4, i32* %Q ;; cannot clobber P since it is nocapture. |
| 11 | %b = load i32* %P |
| 12 | %c = sub i32 %a, %b |
| 13 | ret i32 %c |
| 14 | } |
| 15 | |