summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO
diff options
context:
space:
mode:
authorPeter Collingbourne <peter@pcc.me.uk>2017-07-12 00:39:12 +0000
committerPeter Collingbourne <peter@pcc.me.uk>2017-07-12 00:39:12 +0000
commitcacac6a104ac4e7a0a0bb4ab70c677ded078feb4 (patch)
treec72968439d2873103a014abc489e543fa4b18b4e /llvm/lib/Transforms/IPO
parent68fbf8563fcaf0c24e6757509fa07f3c032c1aa8 (diff)
downloadbcm5719-llvm-cacac6a104ac4e7a0a0bb4ab70c677ded078feb4.tar.gz
bcm5719-llvm-cacac6a104ac4e7a0a0bb4ab70c677ded078feb4.zip
LowerTypeTests: When importing functions skip definitions where the summary contains a decl.
This normally indicates mixed CFI + non-CFI compilation, and will result in us treating the function in the same way as a function defined outside of the LTO unit. Part of PR33752. Differential Revision: https://reviews.llvm.org/D35281 llvm-svn: 307744
Diffstat (limited to 'llvm/lib/Transforms/IPO')
-rw-r--r--llvm/lib/Transforms/IPO/LowerTypeTests.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
index b406c22c69d..693df5e7ba9 100644
--- a/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
+++ b/llvm/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -855,15 +855,20 @@ void LowerTypeTestsModule::importFunction(Function *F, bool isDefinition) {
FDecl = Function::Create(F->getFunctionType(), GlobalValue::ExternalLinkage,
Name + ".cfi_jt", &M);
FDecl->setVisibility(GlobalValue::HiddenVisibility);
- } else {
- // Definition.
- assert(isDefinition);
+ } else if (isDefinition) {
F->setName(Name + ".cfi");
F->setLinkage(GlobalValue::ExternalLinkage);
F->setVisibility(GlobalValue::HiddenVisibility);
FDecl = Function::Create(F->getFunctionType(), GlobalValue::ExternalLinkage,
Name, &M);
FDecl->setVisibility(Visibility);
+ } else {
+ // Function definition without type metadata, where some other translation
+ // unit contained a declaration with type metadata. This normally happens
+ // during mixed CFI + non-CFI compilation. We do nothing with the function
+ // so that it is treated the same way as a function defined outside of the
+ // LTO unit.
+ return;
}
if (F->isWeakForLinker())
OpenPOWER on IntegriCloud