[PATCH] D35281: LowerTypeTests: When importing functions skip definitions where the summary contains a decl.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 17:39:45 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL307744: LowerTypeTests: When importing functions skip definitions where the summary… (authored by pcc).

Changed prior to commit:
  https://reviews.llvm.org/D35281?vs=106121&id=106125#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D35281

Files:
  llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
  llvm/trunk/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml
  llvm/trunk/test/Transforms/LowerTypeTests/import-icall.ll


Index: llvm/trunk/test/Transforms/LowerTypeTests/import-icall.ll
===================================================================
--- llvm/trunk/test/Transforms/LowerTypeTests/import-icall.ll
+++ llvm/trunk/test/Transforms/LowerTypeTests/import-icall.ll
@@ -19,6 +19,10 @@
   ret i8 %x
 }
 
+define void @local_decl() {
+  call void @local_decl()
+  ret void
+}
 
 declare void @external()
 declare extern_weak void @external_weak()
@@ -33,6 +37,9 @@
 ; CHECK:      define internal i8 @local_b() {
 ; CHECK-NEXT:   call i8 @local_a()
 
+; CHECK:      define void @local_decl()
+; CHECK-NEXT:   call void @local_decl()
+
 ; CHECK: declare void @external()
 ; CHECK: declare extern_weak void @external_weak()
 ; CHECK: declare i8 @local_a()
Index: llvm/trunk/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml
===================================================================
--- llvm/trunk/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml
+++ llvm/trunk/test/Transforms/LowerTypeTests/Inputs/import-icall.yaml
@@ -16,4 +16,5 @@
 CfiFunctionDecls:
   - external
   - external_weak
+  - local_decl
 ...
Index: llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
===================================================================
--- llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
+++ llvm/trunk/lib/Transforms/IPO/LowerTypeTests.cpp
@@ -855,15 +855,20 @@
     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())


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35281.106125.patch
Type: text/x-patch
Size: 2347 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170712/d15f311b/attachment.bin>


More information about the llvm-commits mailing list