[all-commits] [llvm/llvm-project] 4c066b: [GlobalDCE] Handle relative pointers in VFE (for S...

Kuba (Brecka) Mracek via All-commits all-commits at lists.llvm.org
Tue Aug 31 07:07:43 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 4c066bd08be3591cfbc81df478c8fc8618755ba1
      https://github.com/llvm/llvm-project/commit/4c066bd08be3591cfbc81df478c8fc8618755ba1
  Author: Kuba Mracek <mracek at apple.com>
  Date:   2021-08-31 (Tue, 31 Aug 2021)

  Changed paths:
    M llvm/include/llvm/Analysis/TypeMetadataUtils.h
    M llvm/lib/Analysis/TypeMetadataUtils.cpp
    M llvm/lib/Transforms/IPO/GlobalDCE.cpp
    A llvm/test/Transforms/GlobalDCE/virtual-functions-relative-pointers-bad.ll
    A llvm/test/Transforms/GlobalDCE/virtual-functions-relative-pointers.ll

  Log Message:
  -----------
  [GlobalDCE] Handle relative pointers in VFE (for Swift vtables)

To support Virtual Function Elimination to Swift, this PR adds support for Swift
vtables which contain "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.

Differential Revision: https://reviews.llvm.org/D107645




More information about the All-commits mailing list