[OpenCL] Fix mangling of single-overload builtins

Commit 9a8d477a0e ("[OpenCL] Add builtin function attribute
handling", 2019-11-05) stopped Clang from mangling single-overload
builtins, which is incorrect.
This commit is contained in:
Sven van Haastregt 2019-12-03 11:07:48 +00:00
parent 4821d2a014
commit 6713670b17
2 changed files with 9 additions and 1 deletions

View File

@ -823,7 +823,8 @@ static void InsertOCLBuiltinDeclarationsFromTable(Sema &S, LookupResult &LR,
NewOpenCLBuiltin->addAttr(ConstAttr::CreateImplicit(Context));
if (OpenCLBuiltin.IsConv)
NewOpenCLBuiltin->addAttr(ConvergentAttr::CreateImplicit(Context));
if ((GenTypeMaxCnt > 1 || Len > 1) && !S.getLangOpts().OpenCLCPlusPlus)
if (!S.getLangOpts().OpenCLCPlusPlus)
NewOpenCLBuiltin->addAttr(OverloadableAttr::CreateImplicit(Context));
LR.addDecl(NewOpenCLBuiltin);

View File

@ -16,6 +16,13 @@ kernel void test_pure_attr(read_only image1d_t img) {
float4 resf = read_imagef(img, 42);
}
// Test that builtins with only one prototype are mangled.
// CHECK-LABEL: @test_mangling
// CHECK: call i32 @_Z12get_local_idj
kernel void test_mangling() {
size_t lid = get_local_id(0);
}
// CHECK: attributes [[ATTR_CONST]] =
// CHECK-SAME: readnone
// CHECK: attributes [[ATTR_PURE]] =