blob: 6d0c7b39297841cc6839e947cbd044bf0b2a4135 [file] [edit]
// NOTE: Assertions have been autogenerated by utils/update_cc_test_checks.py UTC_ARGS: --version 6
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -x hip -std=c++17 -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -x hip -std=c++17 -fclang-abi-compat=11 -emit-llvm %s -o - | FileCheck %s --check-prefix=CLANG11
#include "Inputs/cuda.h"
// A kernel in a template argument, or in an expression in a function template
// signature, is mangled with the name of the kernel, not the name of its host
// stub.
__global__ void kern();
template <auto F> int prepare() { return 0; }
template <typename T> struct Outer {
template <auto F> struct Inner {};
};
template <typename T> void dep(typename Outer<T>::template Inner<kern>) {}
// DEFAULT-LABEL: define dso_local noundef i32 @_Z3usev(
// DEFAULT-SAME: ) #[[ATTR0:[0-9]+]] {
// DEFAULT-NEXT: [[ENTRY:.*:]]
// DEFAULT-NEXT: [[AGG_TMP:%.*]] = alloca %"struct.Outer<int>::Inner", align 1
// DEFAULT-NEXT: call void @_Z3depIiEvN5OuterIT_E5InnerIL_Z4kernvEEE() #[[ATTR2:[0-9]+]]
// DEFAULT-NEXT: [[CALL:%.*]] = call noundef i32 @_Z7prepareITnDaXadL_Z4kernvEEEiv() #[[ATTR2]]
// DEFAULT-NEXT: ret i32 [[CALL]]
//
// CLANG11-LABEL: define dso_local noundef i32 @_Z3usev(
// CLANG11-SAME: ) #[[ATTR0:[0-9]+]] {
// CLANG11-NEXT: [[ENTRY:.*:]]
// CLANG11-NEXT: [[AGG_TMP:%.*]] = alloca %"struct.Outer<int>::Inner", align 1
// CLANG11-NEXT: call void @_Z3depIiEvN5OuterIT_E5InnerIL_Z4kernvEEE() #[[ATTR2:[0-9]+]]
// CLANG11-NEXT: [[CALL:%.*]] = call noundef i32 @_Z7prepareIXadL_Z4kernvEEEiv() #[[ATTR2]]
// CLANG11-NEXT: ret i32 [[CALL]]
//
int use() {
dep<int>(Outer<int>::Inner<kern>());
return prepare<kern>();
}