[PATCH] D26581: Make WholeProgramDevirt understand ConstStruct vtables.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 14:13:41 PST 2016


pcc added inline comments.


================
Comment at: lib/Transforms/IPO/WholeProgramDevirt.cpp:403
+
+      Op = SL->getElementContainingOffset(GlobalSlotOffset);
+    } else if (auto *C = dyn_cast<ConstantArray>(I)) {
----------------
LemonBoy wrote:
> pcc wrote:
> > I think you also want to check that `SL->getElementOffset(Op) == GlobalSlotOffset`.
> > 
> > Please add negative tests for that case and the out-of-bounds case you have above.
> I haven't been able to come up with a way to access the table mid-element via a GEP but have added the check anyway.
See e.g. the unaligned test in bad-read-from-vtable.ll.


https://reviews.llvm.org/D26581





More information about the llvm-commits mailing list