ret i64 %result
}
+declare i64 @consume_attributes(i64, i8* nest, i64)
+define i64 @test_patchpoint_with_attributes() {
+entry:
+; CHECK-LABEL: test_patchpoint_with_attributes:
+; CHECK: movl $42, %edi
+; CHECK: xorl %r10d, %r10d
+; CHECK: movl $17, %esi
+; CHECK: movabsq $_consume_attributes, %r11
+; CHECK-NEXT: callq *%r11
+; CHECK-NEXT: xchgw %ax, %ax
+; CHECK: retq
+ %result = tail call i64 (i64, i32, i8*, i32, ...) @llvm.experimental.patchpoint.i64(i64 21, i32 15, i8* bitcast (i64 (i64, i8*, i64)* @consume_attributes to i8*), i32 3, i64 42, i8* nest null, i64 17)
+ ret i64 %result
+}
+
declare void @llvm.experimental.stackmap(i64, i32, ...)
declare void @llvm.experimental.patchpoint.void(i64, i32, i8*, i32, ...)
declare i64 @llvm.experimental.patchpoint.i64(i64, i32, i8*, i32, ...)
ret i1 true
}
+%struct2 = type { i64, i64, i64 }
+
+declare void @consume_attributes(i32, i8* nest, i32, %struct2* byval)
+
+define void @test_attributes(%struct2* byval %s) gc "statepoint-example" {
+entry:
+; CHECK-LABEL: test_attributes
+; Check that arguments with attributes are lowered correctly.
+; We call a function that has a nest argument and a byval argument.
+; CHECK: movl $42, %edi
+; CHECK: xorl %r10d, %r10d
+; CHECK: movl $17, %esi
+; CHECK: pushq
+; CHECK: pushq
+; CHECK: pushq
+; CHECK: callq consume_attributes
+ %statepoint_token = call token (i64, i32, void (i32, i8*, i32, %struct2*)*, i32, i32, ...) @llvm.experimental.gc.statepoint.p0f_isVoidi32p0i8i32p0s_struct2sf(i64 0, i32 0, void (i32, i8*, i32, %struct2*)* @consume_attributes, i32 4, i32 0, i32 42, i8* nest null, i32 17, %struct2* byval %s, i32 0, i32 0)
+ ret void
+}
declare token @llvm.experimental.gc.statepoint.p0f_i1f(i64, i32, i1 ()*, i32, i32, ...)
declare i1 @llvm.experimental.gc.result.i1(token)
declare token @llvm.experimental.gc.statepoint.p0f_isVoidi32varargf(i64, i32, void (i32, ...)*, i32, i32, ...)
+declare token @llvm.experimental.gc.statepoint.p0f_isVoidi32p0i8i32p0s_struct2sf(i64, i32, void (i32, i8*, i32, %struct2*)*, i32, i32, ...)
+
declare i32 addrspace(1)* @llvm.experimental.gc.relocate.p1i32(token, i32, i32)