Page MenuHomePhabricator

[OpenCL] Added implicit conversion rank for overloading functions with vector data type in OpenCL
ClosedPublic

Authored by echuraev on Mar 10 2017, 3:51 AM.

Details

Summary

I added a new rank to ImplicitConversionRank enum to resolve the function overload ambiguity with vector types. Rank of scalar types conversion is lower than vector splat. So, we can choose which function should we call. See test for more details.

Diff Detail

Event Timeline

echuraev created this revision.Mar 10 2017, 3:51 AM
Anastasia added inline comments.Mar 13 2017, 9:45 AM
test/SemaOpenCL/overload-scalar-widening.cl
4 ↗(On Diff #91308)

I am thinking could this be a CodeGen test instead and we could check that the right overload is selected based on mangled name?

I think in this case it would be good to unify with test/SemaOpenCL/overload_addrspace_resolution.cl which has similar purpose. Also I think CodeGenOpenCL would be a better place for it. :)

echuraev updated this revision to Diff 91691.Mar 14 2017, 2:58 AM
echuraev marked an inline comment as done.
bader added inline comments.Mar 14 2017, 5:38 AM
test/SemaOpenCL/overload_addrspace_resolution.cl
0

Egor, I think you forgot to move the test to CodeGenOpenCL directory.

Anastasia added inline comments.Mar 14 2017, 6:50 AM
test/SemaOpenCL/overload_addrspace_resolution.cl
0

Yes, I think we can also rename it to something more generic like overload.cl.

It would also be nice to start every separate testing section with a comment. Like here could be:

  1. Checking address space resolution
  2. Checking vector vs scalar resolution
echuraev updated this revision to Diff 91713.Mar 14 2017, 7:10 AM
echuraev marked 2 inline comments as done.
bader removed a reviewer: bader.Mar 16 2017, 9:01 AM
bader added a subscriber: bader.
Anastasia accepted this revision.Mar 20 2017, 8:22 AM

LGTM! Thanks!

This revision is now accepted and ready to land.Mar 20 2017, 8:22 AM
echuraev closed this revision.Mar 21 2017, 6:08 AM