Dan Gohman | 81719f8 | 2015-11-25 16:55:01 +0000 | [diff] [blame^] | 1 | ; RUN: llc < %s -asm-verbose=false | FileCheck %s |
| 2 | |
| 3 | ; Test the register stackifier pass. |
| 4 | |
| 5 | target datalayout = "e-p:32:32-i64:64-n32:64-S128" |
| 6 | target triple = "wasm32-unknown-unknown" |
| 7 | |
| 8 | ; No because of pointer aliasing. |
| 9 | |
| 10 | ; CHECK-LABEL: no0: |
| 11 | ; CHECK: return $1{{$}} |
| 12 | define i32 @no0(i32* %p, i32* %q) { |
| 13 | %t = load i32, i32* %q |
| 14 | store i32 0, i32* %p |
| 15 | ret i32 %t |
| 16 | } |
| 17 | |
| 18 | ; No because of side effects. |
| 19 | |
| 20 | ; CHECK-LABEL: no1: |
| 21 | ; CHECK: return $1{{$}} |
| 22 | define i32 @no1(i32* %p, i32* dereferenceable(4) %q) { |
| 23 | %t = load volatile i32, i32* %q, !invariant.load !0 |
| 24 | store volatile i32 0, i32* %p |
| 25 | ret i32 %t |
| 26 | } |
| 27 | |
| 28 | ; Yes because of invariant load and no side effects. |
| 29 | |
| 30 | ; CHECK-LABEL: yes0: |
| 31 | ; CHECK: return $pop0{{$}} |
| 32 | define i32 @yes0(i32* %p, i32* dereferenceable(4) %q) { |
| 33 | %t = load i32, i32* %q, !invariant.load !0 |
| 34 | store i32 0, i32* %p |
| 35 | ret i32 %t |
| 36 | } |
| 37 | |
| 38 | ; Yes because of no intervening side effects. |
| 39 | |
| 40 | ; CHECK-LABEL: yes1: |
| 41 | ; CHECK: return $pop0{{$}} |
| 42 | define i32 @yes1(i32* %q) { |
| 43 | %t = load volatile i32, i32* %q |
| 44 | ret i32 %t |
| 45 | } |
| 46 | |
| 47 | !0 = !{} |