Skip to content

[NFC][SYCL] Fix some uses of stringref& and qualtype& #3504

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Apr 8, 2021

Conversation

erichkeane
Copy link
Contributor

Identified elsewhere, these are a few cases of 'simple' types that are
intended to be copied being passed around as const references. This
patch just replaces them.

Also, StringRefs for can be just llvm::StringLiteral for literals, since
that does constexpr construction.

Identified elsewhere, these are a few cases of 'simple' types that are
intended to be copied being passed around as const references.  This
patch just replaces them.

Also, StringRefs for can be just llvm::StringLiteral for literals, since
that does constexpr construction.
AaronBallman
AaronBallman previously approved these changes Apr 7, 2021
Copy link
Contributor

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Another cleanup for the file would be to remove clang:: and llvm:: prefixes.

@erichkeane
Copy link
Contributor Author

LGTM!

Another cleanup for the file would be to remove clang:: and llvm:: prefixes.

I'm the worst, so I have another big patch coming as soon as it validates ;) We can't lose 'llvm::StringLiteral' unfortunately, since clang::StringLiteral is a thing.

AaronBallman
AaronBallman previously approved these changes Apr 7, 2021
Copy link
Contributor

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Co-authored-by: Aaron Ballman <aaron@aaronballman.com>
Copy link
Contributor

@premanandrao premanandrao left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks Erich.

@bader bader merged commit 5e33df3 into intel:sycl Apr 8, 2021
template <size_t N>
static constexpr DeclContextDesc MakeDeclContextDesc(Decl::Kind K,
const char (&Str)[N]) {
return DeclContextDesc{K, llvm::StringLiteral{Str}};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clang doesn't compile this code:

/home/runner/work/llvm/llvm/src/clang/lib/Sema/SemaSYCL.cpp:76:31: error: no matching constructor for initialization of 'llvm::StringLiteral'
    return DeclContextDesc{K, llvm::StringLiteral{Str}};

Copy link
Contributor Author

@erichkeane erichkeane Apr 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see! I'll push a fixing patch for this ASAP.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh... well something strange is going on with this @bader. As far as I can tell, that code should be completely valid, and it is odd it only happens in that single configuration. I can't reproduce it in other configs either (nor does googling the important note give any hint).

That said, I've fixed it in this commit here: #3520

erichkeane pushed a commit to erichkeane/llvm that referenced this pull request Apr 9, 2021
I'm not sure what causes this to not like this conversion, the error
message seems incorrect and only on certain configs of the build, but we
should fix the build anyway.  This calls the StringRef pointer-size
directly, rather than having the StringLiteral type do it.
bader pushed a commit that referenced this pull request Apr 9, 2021
I'm not sure what causes this to not like this conversion, the error
message seems incorrect and only on certain configs of the build, but we
should fix the build anyway.  This calls the StringRef pointer-size
directly, rather than having the StringLiteral type do it.
alexbatashev pushed a commit to alexbatashev/llvm that referenced this pull request Apr 14, 2021
* upstream/sycl: (39 commits)
  [CI] Switch to default clang-format version. (intel#3540)
  [Driver][NFC] Cleanup some option setting for SYCL offload (intel#3542)
  [GitHub Actions] Update main branch sync schedule
  [SYCL][NFC] Fix potential namespace conflicts with PSTL in tuple.hpp (intel#3541)
  [SYCL] Bump sycl library minor version (intel#3538)
  [SYCL][CUDA] Implemented cuda_piextUSMEnqueueMemAdvise (intel#3365)
  [SYCL][FPGA] Add mutual diagnostic of max_concurrency attribute in conjunction of disable_loop_pipelining attribute (intel#3512)
  [SYCL] [MATRIX] Enable joint_matrix_load, joint_matrix_store, and joint_matrix_mad for AMX (intel#3503)
  [ESIMD] Skip rewriting functions used through function pointers (intel#3527)
  [SYCL] Fix address space for spec constants buffer (intel#3521)
  [SYCL] Correct the tablegen for checking mutually exclusive stmt attrs (intel#3519)
  [SYCL][PI][L0][NFC] Refactor setting of LastCommandEvent (intel#3528)
  [SYCL] Fix group local memory sharing issue (intel#3489)
  [SYCL][NFC] Fix post-commit failure (intel#3532)
  [SYCL][Doc] Remove extension mechanism (intel#3526)
  [SYCL] Move sycl.hpp in install directory and adjust driver to match (intel#3523)
  [SYCL][ESIMD] Update ESIMD docs to address recent user comments: (intel#3516)
  [NFCI][SYCL] Correct -fdeclare-spirv-builtins to use marshalling (intel#3515)
  [SYCL] Rework MarkDevice and children (intel#3475)
  [SYCL] Fix StringLiteral Ctor issue from intel#3504. (intel#3520)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants