[all-commits] [llvm/llvm-project] c2cf93: [WPD/LTT] Lower type test feeding assumes via phi ...

Teresa Johnson via All-commits all-commits at lists.llvm.org
Fri Sep 16 13:50:24 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: c2cf93c1a9f1b8c5b886bb8847ac803d4c053dcf
      https://github.com/llvm/llvm-project/commit/c2cf93c1a9f1b8c5b886bb8847ac803d4c053dcf
  Author: Teresa Johnson <tejohnson at google.com>
  Date:   2022-09-16 (Fri, 16 Sep 2022)

  Changed paths:
    M llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
    A llvm/test/ThinLTO/X86/lower_type_test_phi.ll

  Log Message:
  -----------
  [WPD/LTT] Lower type test feeding assumes via phi correctly

This fixes https://github.com/llvm/llvm-project/issues/57616.

Type test lowering in ThinLTO modules relies on having type id
summaries set up for the referenced types, which provide the type
test resolution. If there is no summary, the type tests are lowered
to false. At the very least, a default type id summary gives the
type tests a resolution of Unknown, which is handled correctly (ignored
by the first invocation of LTT, and lowered to true by the second).

WPD sets up the type id summaries (with a default type test resolution)
as it is processing the type tests, but only does this for the patterns
handled by WPD, which is a type test directly feeding an assume. In the
case of type tests feeding an assume via a phi, the type id summary was
not being set up, leading to the type tests being lowered to false
incorrectly.

Fix this by adding the default type id summary entries for all type ids
used on globals during index-only WPD.

This is not an issue for hybrid (split-lto-unit) LTO, as in that case
the type test resolution is determined and set up during LTT, since the
type definitions are in the regular LTO split module, and exported via
the summary to the ThinLTO split module.

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




More information about the All-commits mailing list