[all-commits] [llvm/llvm-project] d9881e: [IRMover] Avoid materializing global value that be...

Yuanfang Chen via All-commits all-commits at lists.llvm.org
Wed Oct 7 18:23:30 PDT 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: d9881e6e27bc7fa882742b13d43bb6d491dfc1ea
      https://github.com/llvm/llvm-project/commit/d9881e6e27bc7fa882742b13d43bb6d491dfc1ea
  Author: Yuanfang Chen <yuanfang.chen at sony.com>
  Date:   2020-10-07 (Wed, 07 Oct 2020)

  Changed paths:
    M llvm/lib/Linker/IRMover.cpp
    A llvm/test/LTO/X86/Inputs/type-mapping-bug4_0.ll
    A llvm/test/LTO/X86/Inputs/type-mapping-bug4_1.ll
    A llvm/test/LTO/X86/type-mapping-bug4.ll

  Log Message:
  -----------
  [IRMover] Avoid materializing global value that belongs to not-yet-linked module

We saw the same assertion failure mentioned here
https://bugs.llvm.org/show_bug.cgi?id=42063 in our internal tests.

The failure happens in the same circumstance as D47898 and D66814 where
uniqueing of DICompositeTypes causes `Mapper::mapValue` to be called on
GlobalValues(`G`) from a not-yet-linked module(`M`). The following type-mapping for
`G` may not complete correctly (fail to unique types etc.  depending on the
the complexity of the types) because IRLinker::computeTypeMapping is not done for `M`
in this path.

D47898 and D66814 fixed some type-mapping issue after Mapper::mapValue
is called on `G`. However, it seems it did not handle some complex cases. I
think we should delay linking globals like `G` until its owing module is
linked. In this way, we could save unnecessary type mapping and prune
these corner cases. It is also supposed to reduce the total number of structs
ending up in the combined module.

D47898 is reverted (its test is kept) because it regresses the test case here.
D66814 could also be reverted (the `check-all` looks good). But it looks reasonable
anyway, so I thought I should keep it.

Also tested the patch with clang self-host regularLTO/ThinLTO build, things look
good as well.

Reviewed By: tejohnson

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




More information about the All-commits mailing list