[llvm-commits] [llvm-gcc-4-2] r39808 - /llvm-gcc-4-2/trunk/gcc/llvm-convert.cpp
Duncan Sands
baldrick at free.fr
Fri Jul 13 05:15:51 PDT 2007
Author: baldrick
Date: Fri Jul 13 07:15:51 2007
New Revision: 39808
URL: http://llvm.org/viewvc/llvm-project?rev=39808&view=rev
Log:
Forward port of [129262].
A function that only has cleanups (destructors) to run when an exception is raised
currently is not assigned a personality function because we don't bother creating
a call to eh.selector if there are no catches. But the personality function is
still needed, since it is the personality function that analyses the exception
table
and decides where to jump to (to the cleanups in this case). This patch causes a
call to eh.selector to be generated in every landing pad, even if it has no type
infos,
because that specifies the personality function.
Patch from Duncan Sands.
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=39808&r1=39807&r2=39808&view=diff
==============================================================================
--- llvm-gcc-4-2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4-2/trunk/gcc/llvm-convert.cpp Fri Jul 13 07:15:51 2007
@@ -2009,6 +2009,11 @@
// Fetch and store the exception selector.
std::vector<Value*> Args;
+ // The exception and the personality function.
+ Args.push_back(Builder.CreateLoad(ExceptionValue, "eh_ptr"));
+ Args.push_back(CastToType(Instruction::BitCast, FuncCPPPersonality,
+ PointerType::get(Type::Int8Ty)));
+
for (std::vector<EHScope>::reverse_iterator I = CurrentEHScopes.rbegin(),
E = CurrentEHScopes.rend(); I != E; ++I) {
if (TREE_CODE(I->TryExpr) == TRY_CATCH_EXPR) {
@@ -2022,16 +2027,6 @@
EH_FILTER_EXPR) ? FilterExpr : CatchList;
}
- if (I->InfosType == CatchList && !I->TypeInfos.size())
- continue;
-
- // Lazily add the exception and the personality function.
- if (!Args.size()) {
- Args.push_back(Builder.CreateLoad(ExceptionValue, "eh_ptr"));
- Args.push_back(CastToType(Instruction::BitCast, FuncCPPPersonality,
- PointerType::get(Type::Int8Ty)));
- }
-
if (I->InfosType == FilterExpr)
// Filter - note the size.
Args.push_back(ConstantInt::get(Type::Int32Ty, I->TypeInfos.size()));
@@ -2042,11 +2037,9 @@
}
}
- if (Args.size()) {
- Value *Select = Builder.CreateCall(FuncEHSelector, &Args[0], Args.size(),
- "eh_select");
- Builder.CreateStore(Select, ExceptionSelectorValue);
- }
+ Value *Select = Builder.CreateCall(FuncEHSelector, &Args[0], Args.size(),
+ "eh_select");
+ Builder.CreateStore(Select, ExceptionSelectorValue);
}
More information about the llvm-commits
mailing list