This patch contains two improvements for basicaa alias analysis:
- Knowledge that object pointer can't be aliased with vtable loaded from this object (obj->vtable noalias obj).
- Knowledge that virtual call to object can't change this object's vtable. modrefinfo(obj->virt_call, obj->vtable) = REF; modrefinfo(obj->virt_call, obj->vtable->fn) = REF;
Vtable is identified by TBAA metadata (isTBAAVtableAccess - already existing function).
Combined with this patch (http://reviews.llvm.org/D11547) it makes very simple in-loop devirtualization works. This bug's example is fixed: https://llvm.org/bugs/show_bug.cgi?id=20801
But just a bit more complex samples require AliasSetTracker's merge sets problem to be fixed.
"alias set collapse and LICM": https://groups.google.com/forum/#!topic/llvm-dev/Qy66vhi5NaY
This is redundant in many cases (we can already deduce this if the load from the object has TBAA metadata, or if we can see the pointers are distinct), and wrong in other cases (for instance, using memcpy to write over the storage for an object that had a vptr).