]> granicus.if.org Git - clang/commitdiff
Speculatively revert r108156; it appears to be breaking self-host.
authorDouglas Gregor <dgregor@apple.com>
Mon, 12 Jul 2010 21:08:32 +0000 (21:08 +0000)
committerDouglas Gregor <dgregor@apple.com>
Mon, 12 Jul 2010 21:08:32 +0000 (21:08 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@108194 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp
test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp
test/CodeGen/available-externally-suppress.c [deleted file]
test/CodeGen/inline.c
test/CodeGen/inline2.c
test/CodeGenCXX/template-instantiation.cpp
test/CodeGenCXX/visibility-hidden-extern-templates.cpp

index d544d4c233483dd0d6aaea04b6c857479223a5d0..cb83ffde6f03ab46062c679db157675ea82f5ab7 100644 (file)
@@ -817,22 +817,14 @@ void CodeGenModule::EmitGlobalDefinition(GlobalDecl GD) {
     if (Method->isVirtual())
       getVTables().EmitThunks(GD);
 
-  if (const FunctionDecl *Function = dyn_cast<FunctionDecl>(D)) {
-    // At -O0, don't generate IR for functions with available_externally 
-    // linkage.
-    if (CodeGenOpts.OptimizationLevel == 0 &&
-        getFunctionLinkage(Function) 
-                                  == llvm::Function::AvailableExternallyLinkage)
-      return;
-    
-    if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(Function))
-      return EmitCXXConstructor(CD, GD.getCtorType());
+  if (const CXXConstructorDecl *CD = dyn_cast<CXXConstructorDecl>(D))
+    return EmitCXXConstructor(CD, GD.getCtorType());
   
-    if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(Function))
-      return EmitCXXDestructor(DD, GD.getDtorType());
+  if (const CXXDestructorDecl *DD = dyn_cast<CXXDestructorDecl>(D))
+    return EmitCXXDestructor(DD, GD.getDtorType());
 
+  if (isa<FunctionDecl>(D))
     return EmitGlobalFunctionDefinition(GD);
-  }
   
   if (const VarDecl *VD = dyn_cast<VarDecl>(D))
     return EmitGlobalVarDefinition(VD);
index 57b012f9a9463f2abbbe1080cb6bd168bf8635d4..e67233c3754769b584afa96a96980d309d1dce13 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -O1 -emit-llvm -std=c++0x -o - %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -std=c++0x -o - %s | FileCheck %s
 
 template<typename T>
 struct X0 {
diff --git a/test/CodeGen/available-externally-suppress.c b/test/CodeGen/available-externally-suppress.c
deleted file mode 100644 (file)
index c3b7a21..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-// RUN: %clang_cc1 -emit-llvm -o - -O0 -triple x86_64-apple-darwin10 %s | FileCheck %s
-
-// Ensure that we don't emit available_externally functions at -O0.
-int x;
-
-inline void f0(int y) { x = y; }
-
-// CHECK: define void @test()
-// CHECK: declare void @f0(i32)
-void test() {
-  f0(17);
-}
index a6b4b3e4483bafeed959c083cc476e13635c5d0e..a17b06992968834faa5717aa9123974849835d54 100644 (file)
@@ -1,5 +1,5 @@
 // RUN: echo "GNU89 tests:"
-// RUN: %clang %s -O1 -emit-llvm -S -o %t -std=gnu89
+// RUN: %clang %s -emit-llvm -S -o %t -std=gnu89
 // RUN: grep "define available_externally i32 @ei()" %t
 // RUN: grep "define i32 @foo()" %t
 // RUN: grep "define i32 @bar()" %t
@@ -14,7 +14,7 @@
 // RUN: grep "define available_externally i32 @test5" %t
 
 // RUN: echo "\nC99 tests:"
-// RUN: %clang %s -O1 -emit-llvm -S -o %t -std=c99
+// RUN: %clang %s -emit-llvm -S -o %t -std=c99
 // RUN: grep "define i32 @ei()" %t
 // RUN: grep "define available_externally i32 @foo()" %t
 // RUN: grep "define i32 @bar()" %t
@@ -29,7 +29,7 @@
 // RUN: grep "define available_externally i32 @test5" %t
 
 // RUN: echo "\nC++ tests:"
-// RUN: %clang %s -O1 -emit-llvm -S -o %t -std=c++98
+// RUN: %clang %s -emit-llvm -S -o %t -std=c++98
 // RUN: grep "define linkonce_odr i32 @_Z2eiv()" %t
 // RUN: grep "define linkonce_odr i32 @_Z3foov()" %t
 // RUN: grep "define i32 @_Z3barv()" %t
index fca4fff7ca8d7a4d6957a7f39c4b46adef2ffd53..737b58fa44c628634378119213dd11bce1ac7c3a 100644 (file)
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -O1 -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix GNU89 %s
-// RUN: %clang_cc1 -O1 -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix C99 %s
+// RUN: %clang_cc1 -std=gnu89 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix GNU89 %s
+// RUN: %clang_cc1 -std=c99 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck -check-prefix C99 %s
 
 // CHECK-GNU89: define i32 @f0()
 // CHECK-C99: define i32 @f0()
index cb6c812316412b74bc2e145c238b5d2cba25c259..4a3857542d06d220dc94259d0a8dd41a6b2a5119 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -O1 -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s
 
 // CHECK-NOT: @_ZTVN5test118stdio_sync_filebufIwEE = constant
 // CHECK-NOT: _ZTVN5test315basic_fstreamXXIcEE
index 7629b77c2ceef4e212f52a96e6c85b0b2612625f..4c133ec32c726f295d61d48901fca456450b03c5 100644 (file)
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -O1 -emit-llvm -o - -fvisibility hidden %s | FileCheck %s
+// RUN: %clang_cc1 -emit-llvm -o - -fvisibility hidden %s | FileCheck %s
 
 template<typename T>
 struct X {