[LLVMdev] Throwing function being marked nounwind under optimzation?

Evan Cheng evan.cheng at apple.com
Sun Aug 16 13:03:01 PDT 2009


It would help if you post the -O0 and -O1bitcode files.

Does it reproduce with opt -O1? If so, use -debug-pass= to figure out  
when things started going wrong.

Does it make sense to compare the bitcode against code generated for  
x86 target?

Evan


On Aug 16, 2009, at 11:46 AM, Jim Grosbach wrote:

> All,
>
> The following relatively simple function is behaving oddly under SJLJ
> exception handling. Specifically, it's being diagnosed by the
> optimizer as being a nounwind function, which is obviously incorrect.
>
> From what I can tell so far, something is going wrong analyzing the
> call to __cxa_end_catch()
>   invoke arm_apcscc  void @__cxa_end_catch()
>           to label %Unwind unwind label %lpad121
> Something thinks that this invoke will always take the unwind path,
> which isn't the case, and marks the Unwind block as unreachable. As a
> consequence of that, the call to _Unwind_SjLj_Resume() is optimized
> away, and thus the function is considered to not throw in PruneEH.cpp.
> Very strange stuff.
>
> Thoughts on how to proceed in figuring out the root cause of what's
> going wrong?
>
>
> bool ShouldThrow;
>
> int throws()
>   try
> {
>   if (ShouldThrow) throw 7; return 123;
> } catch (...) {
>   printf("'throws' threw an exception: rethrowing!\n");
>   throw;
> }
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list