[PATCH] D31830: Emit invariant.group.barrier when using union field

Piotr Padlewski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 17 10:25:36 PDT 2017


Prazek added inline comments.


================
Comment at: lib/CodeGen/CGExpr.cpp:3517
+        CGM.getCodeGenOpts().StrictVTablePointers &&
+        CGM.getCodeGenOpts().OptimizationLevel > 0)
+      addr = Address(Builder.CreateInvariantGroupBarrier(addr.getPointer()),
----------------
rjmccall wrote:
> Checking for v-table pointers recursively isn't really that difficult, but if you really don't want to do that, please at least check for non-POD-ness or something so that this isn't kicking in for literally every struct type.
ok, I am also planning to fix this in the later patch, because the same problem arise when comparing 2 pointers to dynamic classe. 
I would like to have a bit in CXXRecordDecl to remember if it has any vptr inside that would calculate durring the construction. 
My biggest fear is that if I won't cache it then it will be very slow.


https://reviews.llvm.org/D31830





More information about the cfe-commits mailing list