[WebAssembly] Don't perform the returned-argument optimization on constants.
[oota-llvm.git] / test / CodeGen / NVPTX / nounroll.ll
1 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_20 | FileCheck %s
2
3 target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
4 target triple = "nvptx64-unknown-unknown"
5
6 ; Compiled from the following CUDA code:
7 ;
8 ;   #pragma nounroll
9 ;   for (int i = 0; i < 2; ++i)
10 ;     output[i] = input[i];
11 define void @nounroll(float* %input, float* %output) {
12 ; CHECK-LABEL: .visible .func nounroll(
13 entry:
14   br label %for.body
15
16 for.body:
17 ; CHECK: .pragma "nounroll"
18   %i.06 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
19   %idxprom = sext i32 %i.06 to i64
20   %arrayidx = getelementptr inbounds float, float* %input, i64 %idxprom
21   %0 = load float, float* %arrayidx, align 4
22 ; CHECK: ld.f32
23   %arrayidx2 = getelementptr inbounds float, float* %output, i64 %idxprom
24   store float %0, float* %arrayidx2, align 4
25 ; CHECK: st.f32
26   %inc = add nuw nsw i32 %i.06, 1
27   %exitcond = icmp eq i32 %inc, 2
28   br i1 %exitcond, label %for.end, label %for.body, !llvm.loop !0
29 ; CHECK-NOT: ld.f32
30 ; CHECK-NOT: st.f32
31
32 for.end:
33   ret void
34 }
35
36 !0 = distinct !{!0, !1}
37 !1 = !{!"llvm.loop.unroll.disable"}