As part of codesize optimization work for Swift, we'd like to add Virtual Function Elimination to Swift, very similarly to how GlobalDCE supports C++ VFE. This PR adds support for Swift vtables which contai "relative pointers" instead of direct pointer references. These are in the form of:
@symbol = ... { i32 trunc (i64 sub (i64 ptrtoint (<type> @target to i64), i64 ptrtoint (... @symbol to i64)) to i32) }
The PR extends GlobalDCE's way of looking up a vtable offset into a dependency to be able to see through this expression and find the target symbol.
See the added test for an example this.
I think this comment would be helpful at the declaration in the header, so it is included in the auto-generated documentation. So it might be good to move this to the header and maybe have an inline code comment mark where the swift-specific handling starts?