[PATCH] D106790: prfchwintrin.h: Make _m_prefetchw take a pointer to volatile (PR49124)

Reid Kleckner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 28 12:47:04 PDT 2021


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

In D106790#2909567 <https://reviews.llvm.org/D106790#2909567>, @hans wrote:

> I don't think that should cause any problems. Passing a less qualified pointer to a more cv-qualified parameter should be fine, e.g.

OK, I'm happy then.



================
Comment at: clang/lib/Headers/prfchwintrin.h:54
+#pragma clang diagnostic ignored "-Wcast-qual"
+  __builtin_prefetch ((const void*)__P, 1, 3 /* _MM_HINT_T0 */);
+#pragma clang diagnostic pop
----------------
hans wrote:
> pengfei wrote:
> > Can we declare `__builtin_prefetch` to volatile one in Builtins.def:
> > ```
> > BUILTIN(__builtin_prefetch, "vvCD*.", "nc")
> > ```
> We could, and that would remove the need for the cast, but I'm not sure it would make sense in itself. Since _m_prefetchw is the odd one here, I think it makes sense to do the fix in its implementation.
I agree with @hans, I think leaving the prototype of `__builtin_prefetch` as it is seems reasonable, since it is used elsewhere.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106790/new/

https://reviews.llvm.org/D106790



More information about the cfe-commits mailing list