[ThinLTO/LowerTypeTests] Handle unpromoted local type ids
authorTeresa Johnson <tejohnson@google.com>
Wed, 26 Feb 2020 18:54:56 +0000 (10:54 -0800)
committerTeresa Johnson <tejohnson@google.com>
Mon, 2 Mar 2020 17:31:44 +0000 (09:31 -0800)
commit873c0d0786dcf22f4af39f65df824917f70f2170
tree337821562238fd6c8e4a45c4b431f6c94e868c86
parent7a25bd1d1950f39935afecdebf3c59d2b3f4eae4
[ThinLTO/LowerTypeTests] Handle unpromoted local type ids

Summary:
Fixes an issue that cropped up after the changes in D73242 to delay
the lowering of type tests. LTT couldn't handle any type tests with
non-string type id (which happens for local vtables, which we try to
promote during the compile step but cannot always when there are no
exported symbols).

We can simply treat the same as having an Unknown resolution, which
delays their lowering, still allowing such type tests to be used in
subsequent optimization (e.g. planned usage during ICP). The final
lowering which simply removes these handles them fine.

Beefed up an existing ThinLTO test for such unpromoted type ids so that
the internal vtable isn't removed before lower type tests, which hides
the problem.

Reviewers: evgeny777, pcc

Subscribers: inglorion, hiraditya, steven_wu, dexonsmith, aganea, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75201
llvm/lib/Transforms/IPO/LowerTypeTests.cpp
llvm/test/ThinLTO/X86/nodevirt-nonpromoted-typeid.ll