[llvm-commits] [gcc-plugin] r81375 - /gcc-plugin/trunk/llvm-convert.cpp

Duncan Sands baldrick at free.fr
Wed Sep 9 13:19:44 PDT 2009


Author: baldrick
Date: Wed Sep  9 15:19:43 2009
New Revision: 81375

URL: http://llvm.org/viewvc/llvm-project?rev=81375&view=rev
Log:
Oddly enough, the same variable (tree) can occur multiple times
in the ->local_decls list when compiling with optimization.

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

Modified: gcc-plugin/trunk/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/gcc-plugin/trunk/llvm-convert.cpp?rev=81375&r1=81374&r2=81375&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Wed Sep  9 15:19:43 2009
@@ -630,13 +630,10 @@
 
   // Emit all automatic variables.
   for (tree vars = DECL_STRUCT_FUNCTION(FnDecl)->local_decls; vars;
-       vars = TREE_CHAIN(vars)) {
-    tree var = TREE_VALUE (vars);
-    // Static variables are treated as global variables.
-    if (TREE_STATIC(var))
-      continue;
-    EmitAutomaticVariableDecl(var);
-  }
+       vars = TREE_CHAIN(vars))
+    // Skip static variables and local variables listed multiple times.
+    if (!DECL_LLVM_SET_P(TREE_VALUE(vars)))
+      EmitAutomaticVariableDecl(TREE_VALUE(vars));
 
   // Create a new block for the return node, but don't insert it yet.
   ReturnBB = BasicBlock::Create(Context, "return");





More information about the llvm-commits mailing list