[llvm-commits] [llvm-gcc-4.2] r49375 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp

Duncan Sands baldrick at free.fr
Tue Apr 8 01:07:01 PDT 2008


Author: baldrick
Date: Tue Apr  8 03:07:01 2008
New Revision: 49375

URL: http://llvm.org/viewvc/llvm-project?rev=49375&view=rev
Log:
If compiling without -fexceptions, mark function
bodies as nounwind but not function declarations.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
    llvm-gcc-4.2/trunk/gcc/llvm-types.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=49375&r1=49374&r2=49375&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Tue Apr  8 03:07:01 2008
@@ -642,6 +642,10 @@
   if (DECL_ATTRIBUTES(FnDecl))
     AddAnnotateAttrsToGlobal(Fn, FnDecl);
   
+  // Mark the function "nounwind" if not doing exception handling.
+  if (!flag_exceptions)
+    Fn->setDoesNotThrow();
+
   // Create a new basic block for the function.
   Builder.SetInsertPoint(BasicBlock::Create("entry", Fn));
   

Modified: llvm-gcc-4.2/trunk/gcc/llvm-types.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-types.cpp?rev=49375&r1=49374&r2=49375&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Tue Apr  8 03:07:01 2008
@@ -1054,9 +1054,6 @@
 
   // Compute whether the result needs to be zext or sext'd.
   ParameterAttributes RAttributes = HandleArgumentExtension(ReturnType);
-  // Make sure all functions are marked nounwind if we aren't using exceptions.
-  if (!flag_exceptions && !flag_unwind_tables)
-    RAttributes |= ParamAttr::NoUnwind;
 
   if (RAttributes != ParamAttr::None)
     Attrs.push_back(ParamAttrsWithIndex::get(0, RAttributes));
@@ -1122,9 +1119,7 @@
     RAttributes |= ParamAttr::NoReturn;
 
   // Check for 'nounwind' function attribute.
-  // When flag_exceptions is not set (it is set by default in C++/ObjC++), 
-  // don't unwind anything.
-  if ((flags & ECF_NOTHROW) || (!flag_exceptions && !flag_unwind_tables))
+  if (flags & ECF_NOTHROW)
     RAttributes |= ParamAttr::NoUnwind;
 
   // Check for 'readnone' function attribute.





More information about the llvm-commits mailing list