Justin Lebar | d596ec9 | 2016-02-17 17:46:50 +0000 | [diff] [blame] | 1 | ; RUN: llc < %s | FileCheck %s |
| 2 | target triple = "nvptx64-nvidia-cuda" |
| 3 | |
| 4 | declare void @foo() |
| 5 | |
| 6 | ; Load a value, then call a function. Branch, and use the loaded value only on |
| 7 | ; one side of the branch. The load shouldn't be sunk beneath the call, because |
| 8 | ; the call may modify memory. |
| 9 | define i32 @f(i32 %x, i32* %ptr, i1 %cond) { |
| 10 | Start: |
| 11 | ; CHECK: ld.u32 |
| 12 | %ptr_val = load i32, i32* %ptr |
| 13 | ; CHECK: call.uni |
| 14 | call void @foo() |
| 15 | br i1 %cond, label %L1, label %L2 |
| 16 | L1: |
| 17 | %ptr_val2 = add i32 %ptr_val, 100 |
| 18 | br label %L2 |
| 19 | L2: |
| 20 | %v4 = phi i32 [ %x, %Start ], [ %ptr_val2, %L1 ] |
| 21 | %v5 = add i32 %v4, 1000 |
| 22 | ret i32 %v5 |
| 23 | } |