[PATCH] D32378: Insert invariant.group.barrier for pointers comparisons

Richard Smith via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 21 15:41:15 PDT 2017


rsmith added inline comments.


================
Comment at: lib/CodeGen/CGExprScalar.cpp:3066-3067
+    } else { // Unsigned integers and pointers.
+      if (CGF.CGM.getCodeGenOpts().StrictVTablePointers &&
+          CGF.CGM.getCodeGenOpts().OptimizationLevel > 0) {
+        // Based on comparisons of pointers to dynamic objects, the optimizer
----------------
I think we need to do this regardless of optimization level -- if we LTO together a -O0 translation unit with a -O2 translation unit, we still need this protection for the comparisons in the -O0 TU.

(IIRC we chose to make -fstrict-vtable-pointers an IR-level ABI break, but we shouldn't do the same thing for optimization level.)


https://reviews.llvm.org/D32378





More information about the cfe-commits mailing list