Page MenuHomePhabricator

[OpenCL][Sema] Fix builtin rewriting
ClosedPublic

Authored by mantognini on Jul 2 2019, 6:24 AM.

Details

Summary

This patch ensures built-in functions are rewritten using the proper
parent declaration. Tests are added to ensure the functionality works
also with C++ for OpenCL.

Event Timeline

mantognini created this revision.Jul 2 2019, 6:24 AM
Herald added a project: Restricted Project. · View Herald TranscriptJul 2 2019, 6:25 AM

I would say in the interest of saving testing time running one of those test in C++ mode should be enough.

clang/lib/Sema/SemaExpr.cpp
5411

I think these builtins were added before we could specify address spaces in tablegen file. So I think we should actually change these builtins to add the address spaces on pointers such that this code wouldn't be called at all. But your fix is still needed for general cases.

If you either write FIXME next to the OpenCL builtins in Builtins.td to add the address spaces or create a bugzilla bug describing this problem I am happy to go ahead with this patch.

mantognini updated this revision to Diff 207569.Jul 2 2019, 8:51 AM

Address comments: reduce testing & add FIXME.

mantognini marked an inline comment as done.Jul 2 2019, 8:52 AM

I added the FIXME and reduced the amount of testing. Let me know if it looks alright.

Anastasia accepted this revision.Jul 3 2019, 10:42 AM

LGTM! Thanks!

clang/include/clang/Basic/Builtins.def
1516

-> FIXME:

This revision is now accepted and ready to land.Jul 3 2019, 10:42 AM
mantognini updated this revision to Diff 207994.Jul 4 2019, 2:14 AM

Addressed missing colon in FIXME comment.

mantognini marked an inline comment as done.Jul 4 2019, 2:15 AM

I'll commit this along with D64083 in a few days in case John has any feedback.