This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Add implicit conversion of __launch_bounds__ arguments to rvalue.
ClosedPublic

Authored by tra on Jun 3 2016, 1:39 PM.

Diff Detail

Event Timeline

tra updated this revision to Diff 59611.Jun 3 2016, 1:39 PM
tra retitled this revision from to [CUDA] Add implicit conversion of __launch_bounds__ arguments to rvalue. .
tra updated this object.
tra added reviewers: rsmith, jlebar.
tra added a subscriber: cfe-commits.
jlebar edited edge metadata.Jun 3 2016, 1:44 PM

How is this different from test/SemaCUDA/launch_bounds.cu:27-28? It does

const int constint = 512;
__launch_bounds__(constint) void TestConstInt(void);

which looks verbatim the same as this testcase.

tra added a comment.Jun 3 2016, 1:54 PM

How is this different from test/SemaCUDA/launch_bounds.cu:27-28? It does

const int constint = 512;
__launch_bounds__(constint) void TestConstInt(void);

which looks verbatim the same as this testcase.

Existing test is a declaration of the function which did not trigger the crash.
Second issue is that -verify interferes with reproduction case -- the crash does not happen if any //expect-* are seen before it.
Plus, the outcome of the failing test is a crash which would prevent reports of other failures.
Separate test file makes the crash isolated and reliably reproducible.

jlebar added a comment.Jun 3 2016, 1:58 PM
In D20985#448836, @tra wrote:

How is this different from test/SemaCUDA/launch_bounds.cu:27-28? It does

const int constint = 512;
__launch_bounds__(constint) void TestConstInt(void);

which looks verbatim the same as this testcase.

Existing test is a declaration of the function which did not trigger the crash.
Second issue is that -verify interferes with reproduction case -- the crash does not happen if any //expect-* are seen before it.
Plus, the outcome of the failing test is a crash which would prevent reports of other failures.
Separate test file makes the crash isolated and reliably reproducible.

Got it, thanks.

Should we have a test that passes a char or a short and ensures that we do the correct implicit conversion there?

lib/Sema/SemaDeclAttr.cpp
4045

Should we update this name and comment?

tra updated this revision to Diff 59624.Jun 3 2016, 2:29 PM
tra edited edge metadata.

Addressed Justin's comments.

jlebar accepted this revision.Jun 3 2016, 2:32 PM
jlebar edited edge metadata.
jlebar added inline comments.
lib/Sema/SemaDeclAttr.cpp
4046

Nit, Oxford comma helps some here.

4048

Presumably it "returns nullptr and outputs an error" otherwise? Like, we get nullptr iff it outputs an error?

4077

Do we need to output an error here, or is does PerformCopyInitialization do so for us? In any case, is it covered by a test?

This revision is now accepted and ready to land.Jun 3 2016, 2:32 PM
tra marked 3 inline comments as done.Jun 3 2016, 3:00 PM
tra added inline comments.
lib/Sema/SemaDeclAttr.cpp
4048

It returns nullptr without error message in case of unexpanded parameter pack.
Arguments for that case will be checked after template instantiation is done. See instantiateDependentCUDALaunchBoundsAttr() in SemaTemplateInstantiateDecl.cpp.

4077

Actually, by this point we've verified that Expr is an ICE. I assume that PerformCopyInitialization() should always succeed for such an expression.

tra updated this revision to Diff 59631.Jun 3 2016, 3:01 PM
tra edited edge metadata.
tra marked an inline comment as done.

Rephrased comments

jlebar added inline comments.Jun 3 2016, 4:55 PM
lib/Sema/SemaDeclAttr.cpp
4077

OK, so then we want an assert, not an if?

tra updated this revision to Diff 59778.Jun 6 2016, 1:38 PM

Replaced if() with assert() to catch unexpected PerformCopyInitialization() failures.

tra marked an inline comment as done.Jun 6 2016, 1:38 PM
This revision was automatically updated to reflect the committed changes.