TypeID summaries are used by CFI and need to be serialized by ThinLTO
indexing for later use by LTO Backend.
Details
Diff Detail
- Build Status
Buildable 14892 Build 14892: arc lint + arc unit
Event Timeline
This needs more tests. In particular you should have:
- More test coverage for serialization.
- A test for the bitcode reader functionality. This should probably be in the form of a test that simulates a distributed build and shows that the correct resolution is passed to the backend. There are a few examples in clang/test/CodeGen/thinlto-* but they all use the legacy LTO API driver (llvm-lto) which is incompatible with ThinLTO+CFI, so you will probably need to have your test use llvm-lto2 (with the -thinlto-distributed-indexes flag).
clang/test/CodeGen/thinlto-distributed-cfi-devirt.cpp | ||
---|---|---|
8 | I wonder whether you can simplify this test by making this a .ll file and using opt -thinlto-bc to create the .o file. | |
73 | I think this will only work on Linux. Same goes for your other tests. | |
75 | It may be simpler to test the effect of lowertypetests by passing -emit-llvm to clang and examining the IR. | |
clang/test/CodeGen/thinlto-distributed-cfi.cpp | ||
81 | Since this test and thinlto-distributed-cfi-devirt.cpp use the same inputs, you can merge them into one file. |
clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll | ||
---|---|---|
39–43 ↗ | (On Diff #133986) | I would move these alongside the IR that is being tested. |
58–59 ↗ | (On Diff #133986) | Remove these. |
69 ↗ | (On Diff #133986) | This intrinsic call looks a little odd if the intent is to test that whole-program devirtualization was not applied. In principle it could be locally devirtualized by loading a function pointer from the constant _ZTV1B, which would make the branch below unconditional. Can you instead load a vtable from a passed-in object and pass that to the intrinsic? Basically, make this look like call2 or call3 in llvm/test/Transforms/WholeProgramDevirt/import.ll. The same goes for the other call below. It was also a little surprising to me at first that this wasn't virtual-const-propagated, but I guess the reason why it wasn't is that you are passing an argument of type double. A more reliable way of preventing virtual const prop would be to pass undef as one of the arguments (see call2 in the same test). |
82 ↗ | (On Diff #133986) | Can you please also include testing for successful devirtualization? I guess you could do that by changing the metadata here to !"_ZTS1B" and testing that the call was successfully single-impl-devirtualized. |
clang/test/CodeGen/thinlto-distributed-cfi.ll | ||
27 ↗ | (On Diff #133986) | You could write -o - here and pipe into FileCheck as usual. |
49 ↗ | (On Diff #133986) | The backend could in principle replace this with true because the first argument is a constant. Could you instead add an argument to main and pass that argument through as the first argument here? |
clang/test/CodeGen/thinlto-distributed-cfi-devirt.ll | ||
---|---|---|
59 ↗ | (On Diff #134313) | done in r325184 |
I wonder whether you can simplify this test by making this a .ll file and using opt -thinlto-bc to create the .o file.