[llvm-commits] [llvm] r49006 - in /llvm/trunk/lib: CodeGen/DwarfWriter.cpp CodeGen/LLVMTargetMachine.cpp CodeGen/SelectionDAG/SelectionDAGISel.cpp Target/PowerPC/PPCAsmPrinter.cpp Target/PowerPC/PPCRegisterInfo.cpp Target/X86/X86AsmPrinter.cpp Target/X86/X86RegisterInfo.cpp Transforms/Utils/LowerInvoke.cpp

Chris Lattner clattner at apple.com
Tue Apr 1 11:31:01 PDT 2008


On Apr 1, 2008, at 11:22 AM, Dale Johannesen wrote:

>>>> In this case, that is because baz() could throw.  Try:
>>>>
>>>> int foo() {
>>>> try {
>>>>  bar();
>>>> } catch(...) {
>>>>  return 17
>>>> }
>>>> return 42;
>>>> }
>>>
>>> llvm-gcc still does not mark foo as nounwind.
>>
>> Regardless of whether it does or not, it would be correct for it to  
>> be
>> marked nounwind.  This detail is a missed optimization in llvm-gcc,
>> but it doesn't affect the discussion afaict.
>
> No, it only affects whether things work:)

The semantics of the nounwind attribute are independent of whether  
llvm-gcc happens to apply it or not.  In this case, not marking it  
nounwind may be a missed optimization, but applying it *is* correct  
and should not "break" the code.

>> How about something like:
>>
>> void bar();
>> int foo() throw() {
>>  bar();
>> }
>>
>> Same idea, and it is marked nounwind.
>
> OK, this one I believe.  While llvm-g++ does produce an EH table,  
> llvm-
> g++ -emit-llvm | llc does not.  I'll fix it.

Thanks Dale!

-Chris




More information about the llvm-commits mailing list