This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Disallow negative attribute arguments
ClosedPublic

Authored by asavonic on Aug 3 2018, 8:51 AM.

Details

Summary

Negative arguments in kernel attributes are silently bitcast'ed to
unsigned, for example:

__attribute__((reqd_work_group_size(1, -1, 1)))
__kernel void k() {}

is a complete equivalent of:

__attribute__((reqd_work_group_size(1, 4294967294, 1)))
__kernel void k() {}

This is likely an error, so the patch forbids negative arguments in
several OpenCL attributes. Users who really want 4294967294 can still
use it as an unsigned representation.

Diff Detail

Repository
rC Clang

Event Timeline

asavonic created this revision.Aug 3 2018, 8:51 AM
This revision is now accepted and ready to land.Aug 17 2018, 7:44 AM
bader accepted this revision.Aug 17 2018, 8:03 AM
bader added a subscriber: bader.

LGTM.
Please, remove "Change-Id: I910b5c077f5f29e02a1572d9202f0fdbea5280fd" from the log message - it not relevant to the project.

yaxunl accepted this revision.Aug 17 2018, 2:58 PM

LGTM. Thanks.

asavonic edited the summary of this revision. (Show Details)Aug 20 2018, 12:36 AM
This revision was automatically updated to reflect the committed changes.