[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:12:57 PDT 2008


On Apr 1, 2008, at 10:49 AM, Dale Johannesen wrote:

>
> On Apr 1, 2008, at 10:40 AM, Chris Lattner wrote:
>>>
>>> Hmm.  llvm-gcc does not, in fact, mark foo() as nounwind.
>>
>> 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.

How about something like:

void bar();
int foo() throw() {
   bar();
}

Same idea, and it is marked nounwind.

-Chris




More information about the llvm-commits mailing list