[PATCH] D134012: [WPD/LTT] Lower type test feeding assumes via phi correctly

Teresa Johnson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 15 20:49:01 PDT 2022


tejohnson created this revision.
tejohnson added a reviewer: aeubanks.
Herald added subscribers: ormris, steven_wu, hiraditya.
Herald added a project: All.
tejohnson requested review of this revision.
Herald added a project: LLVM.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134012

Files:
  llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp
  llvm/test/ThinLTO/X86/lower_type_test_phi.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134012.460625.patch
Type: text/x-patch
Size: 10299 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220916/0facdb8c/attachment.bin>


More information about the llvm-commits mailing list