[WebAssembly] Don't perform the returned-argument optimization on constants.
[oota-llvm.git] / test / CodeGen / NVPTX / bug21465.ll
1 ; RUN: opt < %s -nvptx-lower-kernel-args -S | FileCheck %s
2 ; RUN: llc < %s -march=nvptx64 -mcpu=sm_35 | FileCheck %s --check-prefix PTX
3
4 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v16:16:16-v32:32:32-v64:64:64-v128:128:128-n16:32:64"
5 target triple = "nvptx64-unknown-unknown"
6
7 %struct.S = type { i32, i32 }
8
9 ; Function Attrs: nounwind
10 define void @_Z11TakesStruct1SPi(%struct.S* byval nocapture readonly %input, i32* nocapture %output) #0 {
11 entry:
12 ; CHECK-LABEL: @_Z11TakesStruct1SPi
13 ; PTX-LABEL: .visible .entry _Z11TakesStruct1SPi(
14 ; CHECK: addrspacecast %struct.S* %input to %struct.S addrspace(101)*
15   %b = getelementptr inbounds %struct.S, %struct.S* %input, i64 0, i32 1
16   %0 = load i32, i32* %b, align 4
17 ; PTX-NOT: ld.param.u32 {{%r[0-9]+}}, [{{%rd[0-9]+}}]
18 ; PTX: ld.param.u32 [[value:%r[0-9]+]], [{{%rd[0-9]+}}+4]
19   store i32 %0, i32* %output, align 4
20 ; PTX-NEXT: st.global.u32 [{{%rd[0-9]+}}], [[value]]
21   ret void
22 }
23
24 attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
25
26 !nvvm.annotations = !{!0}
27
28 !0 = !{void (%struct.S*, i32*)* @_Z11TakesStruct1SPi, !"kernel", i32 1}