[llvm-commits] [llvm-gcc-4.2] r49171 - in /llvm-gcc-4.2/trunk/gcc: llvm-convert.cpp llvm-types.cpp
Dale Johannesen
dalej at apple.com
Thu Apr 3 10:27:26 PDT 2008
Author: johannes
Date: Thu Apr 3 12:27:23 2008
New Revision: 49171
URL: http://llvm.org/viewvc/llvm-project?rev=49171&view=rev
Log:
Mark all functions nounwind when -fexceptions is off.
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=49171&r1=49170&r2=49171&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Apr 3 12:27:23 2008
@@ -2494,7 +2494,7 @@
PAL = cast<Function>(Callee)->getParamAttrs();
// Work out whether to use an invoke or an ordinary call.
- if (!tree_could_throw_p(exp))
+ if (!tree_could_throw_p(exp) || !flag_exceptions)
// This call does not throw - mark it 'nounwind'.
PAL = PAL.addAttr(0, ParamAttr::NoUnwind);
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=49171&r1=49170&r2=49171&view=diff
==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-types.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-types.cpp Thu Apr 3 12:27:23 2008
@@ -1048,6 +1048,10 @@
// 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)
+ RAttributes |= ParamAttr::NoUnwind;
+
if (RAttributes != ParamAttr::None)
Attrs.push_back(ParamAttrsWithIndex::get(0, RAttributes));
@@ -1112,7 +1116,9 @@
RAttributes |= ParamAttr::NoReturn;
// Check for 'nounwind' function attribute.
- if (flags & ECF_NOTHROW)
+ // When flag_exceptions is not set (it is set by default in C++/ObjC++),
+ // don't unwind anything.
+ if ((flags & ECF_NOTHROW) || !flag_exceptions)
RAttributes |= ParamAttr::NoUnwind;
// Check for 'readnone' function attribute.
More information about the llvm-commits
mailing list