[llvm-commits] [llvm-gcc-4.2] r40532 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Anton Korobeynikov asl at math.spbu.ru
Thu Jul 26 08:47:14 PDT 2007


Author: asl
Date: Thu Jul 26 10:47:14 2007
New Revision: 40532

URL: http://llvm.org/viewvc/llvm-project?rev=40532&view=rev
Log:
This correct way to handle with globals.

This makes MultiSource/{Applications,Benchmarks} and
SingleSource/{Applications,Benchmark} (C parts) to pass
being compiled with llvm-gcc-4.2!

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=40532&r1=40531&r2=40532&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Jul 26 10:47:14 2007
@@ -5048,7 +5048,7 @@
     // If this is an aggregate, emit it to LLVM now.  GCC happens to
     // get this case right by forcing the initializer into memory.
     if (TREE_CODE(exp) == CONST_DECL || TREE_CODE(exp) == VAR_DECL) {
-      if (GV->isDeclaration()) {
+      if ((DECL_INITIAL(exp) || !TREE_PUBLIC(exp)) && GV->isDeclaration()) {
         emit_global_to_llvm(exp);
         Decl = DECL_LLVM(exp);     // Decl could have change if it changed type.
       }
@@ -6124,11 +6124,11 @@
     TREE_USED(exp) = 1;
     Val = cast<GlobalValue>(DECL_LLVM(exp));
   }
-  
+
   // If this is an aggregate, emit it to LLVM now.  GCC happens to
   // get this case right by forcing the initializer into memory.
   if (TREE_CODE(exp) == CONST_DECL || TREE_CODE(exp) == VAR_DECL) {
-    if (Val->isDeclaration()) {
+    if ((DECL_INITIAL(exp) || !TREE_PUBLIC(exp)) && Val->isDeclaration()) {
       emit_global_to_llvm(exp);
       // Decl could have change if it changed type.
       Val = cast<GlobalValue>(DECL_LLVM(exp));





More information about the llvm-commits mailing list