[PATCH][ARM] Fix assertion failure in SjLjEHPrepare

Kai Nacke kai at redstar.de
Mon May 13 11:15:32 PDT 2013


On 13.05.2013 19:55, Bob Wilson wrote:
>
> On May 13, 2013, at 10:47 AM, Kai Nacke <kai at redstar.de> wrote:
>
>> On 08.05.2013 19:38, Renato Golin wrote:
>>>
>>> Looks reasonable, but I'd wait until some Darwin expert chime in.
>>>
>>
>> Are there any Darwin expert around here?
>
> Yes, we have some of those.  Kai, can you provide a test case that demonstrates the problem?  We compile lots of ARM code with EH for Darwin and have not been hitting this problem.  I'd like to understand what's different that causes you to hit this assertion.
>

For sure! Attached is exc4.ll which crashes llc using -march=arm 
-mtriple=arm-darwin -filetype=obj.

The IR is a reduced version of the following D code, produced by LDC:

extern(C) void bar();

extern(C) void foo()
{
     try
     {
         bar();
     }
     finally
     {
     }
}

Kai
-------------- next part --------------
; ModuleID = 'exc4.d'
target datalayout = "e-p:32:32:32-S32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f16:16:16-f32:32:32-f64:32:64-f128:128:128-v64:32:64-v128:32:128-a0:0:64-n32"
target triple = "arm--darwin"

declare void @bar()

define void @foo() {
entry:
  br label %try

try:                                              ; preds = %entry
  invoke void @bar()
          to label %postinvoke unwind label %landingpad

postinvoke:                                       ; preds = %try
  br label %finally

finally:                                          ; preds = %postinvoke
  br label %endtryfinally

landingpad:                                       ; preds = %try
  %0 = landingpad { i8*, i32 } personality i32 (i32, i32, i64, i8*, i8*)* @_d_eh_personality
          cleanup
  %tmp = extractvalue { i8*, i32 } %0, 0
  %tmp1 = extractvalue { i8*, i32 } %0, 1
  call void @_d_eh_resume_unwind(i8* %tmp)
  unreachable

endtryfinally:                                    ; preds = %finally
  ret void
}

declare i32 @_d_eh_personality(i32, i32, i64, i8*, i8*)

; Function Attrs: nounwind readnone
declare i32 @llvm.eh.typeid.for(i8*) #0

declare void @_d_eh_resume_unwind(i8*)



More information about the llvm-commits mailing list