diff options
| author | Teresa Johnson <tejohnson@google.com> | 2019-02-14 21:22:50 +0000 |
|---|---|---|
| committer | Teresa Johnson <tejohnson@google.com> | 2019-02-14 21:22:50 +0000 |
| commit | d0b1f30b32bda78267a48f1812adabcfe872fe43 (patch) | |
| tree | 757cae08fe889355fbecc65301f6dbb0d9fffe9c /llvm/lib/Transforms | |
| parent | 8e918d6eadba93c4dea2940d48b74e1bea7f53e9 (diff) | |
| download | bcm5719-llvm-d0b1f30b32bda78267a48f1812adabcfe872fe43.tar.gz bcm5719-llvm-d0b1f30b32bda78267a48f1812adabcfe872fe43.zip | |
[ThinLTO] Detect partially split modules during the thin link
Summary:
The changes to disable LTO unit splitting by default (r350949) and
detect inconsistently split LTO units (r350948) are causing some crashes
when the inconsistency is detected in multiple threads simultaneously.
Fix that by having the code always look for the inconsistently split
LTO units during the thin link, by checking for the presence of type
tests recorded in the summaries.
Modify test added in r350948 to remove single threading required to fix
a bot failure due to this issue (and some debugging options added in the
process of diagnosing it).
Reviewers: pcc
Subscribers: mehdi_amini, inglorion, eraman, steven_wu, dexonsmith, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D57561
llvm-svn: 354062
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/IPO/LowerTypeTests.cpp | 15 | ||||
| -rw-r--r-- | llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp | 19 |
2 files changed, 16 insertions, 18 deletions
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp index 2f8a96be875..398005d2234 100644 --- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp +++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp @@ -1692,6 +1692,14 @@ void LowerTypeTestsModule::replaceDirectCalls(Value *Old, Value *New) { } bool LowerTypeTestsModule::lower() { + // If only some of the modules were split, we cannot correctly perform + // this transformation. We already checked for the presense of type tests + // with partially split modules during the thin link, and would have emitted + // an error if any were found, so here we can simply return. + if ((ExportSummary && ExportSummary->partiallySplitLTOUnits()) || + (ImportSummary && ImportSummary->partiallySplitLTOUnits())) + return false; + Function *TypeTestFunc = M.getFunction(Intrinsic::getName(Intrinsic::type_test)); Function *ICallBranchFunnelFunc = @@ -1701,13 +1709,6 @@ bool LowerTypeTestsModule::lower() { !ExportSummary && !ImportSummary) return false; - // If only some of the modules were split, we cannot correctly handle - // code that contains type tests. - if (TypeTestFunc && !TypeTestFunc->use_empty() && - ((ExportSummary && ExportSummary->partiallySplitLTOUnits()) || - (ImportSummary && ImportSummary->partiallySplitLTOUnits()))) - report_fatal_error("inconsistent LTO Unit splitting with llvm.type.test"); - if (ImportSummary) { if (TypeTestFunc) { for (auto UI = TypeTestFunc->use_begin(), UE = TypeTestFunc->use_end(); diff --git a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp index ab6f0eb660f..6b6dd6194e1 100644 --- a/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -1563,23 +1563,20 @@ void DevirtModule::removeRedundantTypeTests() { } bool DevirtModule::run() { + // If only some of the modules were split, we cannot correctly perform + // this transformation. We already checked for the presense of type tests + // with partially split modules during the thin link, and would have emitted + // an error if any were found, so here we can simply return. + if ((ExportSummary && ExportSummary->partiallySplitLTOUnits()) || + (ImportSummary && ImportSummary->partiallySplitLTOUnits())) + return false; + Function *TypeTestFunc = M.getFunction(Intrinsic::getName(Intrinsic::type_test)); Function *TypeCheckedLoadFunc = M.getFunction(Intrinsic::getName(Intrinsic::type_checked_load)); Function *AssumeFunc = M.getFunction(Intrinsic::getName(Intrinsic::assume)); - // If only some of the modules were split, we cannot correctly handle - // code that contains type tests or type checked loads. - if ((ExportSummary && ExportSummary->partiallySplitLTOUnits()) || - (ImportSummary && ImportSummary->partiallySplitLTOUnits())) { - if ((TypeTestFunc && !TypeTestFunc->use_empty()) || - (TypeCheckedLoadFunc && !TypeCheckedLoadFunc->use_empty())) - report_fatal_error("inconsistent LTO Unit splitting with llvm.type.test " - "or llvm.type.checked.load"); - return false; - } - // Normally if there are no users of the devirtualization intrinsics in the // module, this pass has nothing to do. But if we are exporting, we also need // to handle any users that appear only in the function summaries. |

