This is an archive of the discontinued LLVM Phabricator instance.

[OpenCL] Add string literals to the constant address space.
ClosedPublic

Authored by joey on May 30 2013, 7:21 AM.

Details

Reviewers
joey
Summary

OpenCL requires string literals to be in the constant address space.

Diff Detail

Event Timeline

Does LangOpts.OpenCL imply LangOpts.ConstStrings? It probably should, just in case anything else is checking to see if it can rely on all string constants being const. You could even then (in a followup patch) complain if anyone tried to turn this off, e.g. with -fwritable-strings.

(I see that you still have to special case the address space.)

joey updated this revision to Unknown Object (????).May 31 2013, 3:10 AM

I made LangOpts.OpenCL imply LangOpts.ConstStrings, and updated some of the tests I missed the first time round.

joey updated this revision to Unknown Object (????).May 31 2013, 6:35 AM

I forgot to add the CodeGen parts of this patch to the review, here it is.

joey updated this revision to Unknown Object (????).Nov 14 2013, 6:51 AM

I updated this patch to remove the 'const' part as I now believe it is wrong, and I changed IsModifiable as Tanya suggested.

Ok to commit?

Sorry about the long delay on this.

This is supposed to use the string constant sharing mechanism, right? Maybe a test could be added that checks that the constant data is shared for two same string constants? Otherwise, LGTM.

joey closed this revision.Nov 14 2013, 10:33 AM

r194717, thanks!