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

Duncan Sands baldrick at free.fr
Mon Aug 31 03:04:16 PDT 2009


Author: baldrick
Date: Mon Aug 31 05:04:15 2009
New Revision: 80583

URL: http://llvm.org/viewvc/llvm-project?rev=80583&view=rev
Log:
Free memory allocated using gimple_to_tree.

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=80583&r1=80582&r2=80583&view=diff

==============================================================================
--- gcc-plugin/trunk/llvm-convert.cpp (original)
+++ gcc-plugin/trunk/llvm-convert.cpp Mon Aug 31 05:04:15 2009
@@ -750,6 +750,7 @@
 }
 
 extern "C" tree gimple_to_tree(gimple);
+extern "C" void release_stmt_tree (gimple, tree);
 
 Function *TreeToLLVM::EmitFunction() {
   // Set up parameters and prepare for return, for the function.
@@ -777,17 +778,19 @@
       case GIMPLE_PREDICT:
       case GIMPLE_RESX: {
         // TODO Handle gimple directly, rather than converting to a tree.
-        MemRef DestLoc;
         tree stmt = gimple_to_tree(gimple_stmt);
 
         // If this stmt returns an aggregate value (e.g. a call whose result is
         // ignored), create a temporary to receive the value.  Note that we don't
         // do this for MODIFY_EXPRs as an efficiency hack.
+        MemRef DestLoc;
         if (isAggregateTreeType(TREE_TYPE(stmt)) &&
             TREE_CODE(stmt)!= MODIFY_EXPR && TREE_CODE(stmt)!=INIT_EXPR)
           DestLoc = CreateTempLoc(ConvertType(TREE_TYPE(stmt)));
 
         Emit(stmt, DestLoc.Ptr ? &DestLoc : NULL);
+
+        release_stmt_tree(gimple_stmt, stmt);
         break;
       }
 





More information about the llvm-commits mailing list