[PATCH] D40218: [Clang] Add __builtin_launder

Eric Fiselier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 12 17:23:31 PST 2018


EricWF marked 2 inline comments as done.
EricWF added inline comments.


================
Comment at: lib/CodeGen/CGBuiltin.cpp:1674
+    Value *Ptr = EmitScalarExpr(E->getArg(0));
+    Ptr = Builder.CreateInvariantGroupBarrier(Ptr);
+    return RValue::get(Ptr);
----------------
rsmith wrote:
> It would be nice to avoid this for types that contain no const subobjects / reference subobjects / vptrs. I think we can also omit this entirely if `-fstrict-vtable-ptrs` is disabled, since in that case we don't generate any `invariant.group` metadata.
> 
> I'd be OK with the former being left to a future change, but the latter should be part of this change so we don't generate unnecessarily-inefficient code in the default mode for uses of `std::launder`.
I'll put it in this change set.


https://reviews.llvm.org/D40218





More information about the cfe-commits mailing list