@@ -588,9 +588,11 @@ def process_Raise(self, insn):
588
588
return llinsn
589
589
590
590
def process_LandingPad (self , insn ):
591
- lllandingpad = self .llbuilder .landingpad (self . llty_of_type ( insn . type ),
591
+ lllandingpad = self .llbuilder .landingpad (ll . LiteralStructType ([ ll . IntType ( 8 ). as_pointer ()] ),
592
592
self .llbuiltin ("__artiq_personality" ))
593
- llexnnameptr = self .llbuilder .gep (lllandingpad , [self .llindex (0 ), self .llindex (0 )])
593
+ llrawexn = self .llbuilder .extract_value (lllandingpad , 0 )
594
+ llexn = self .llbuilder .bitcast (llrawexn , self .llty_of_type (insn .type ))
595
+ llexnnameptr = self .llbuilder .gep (llexn , [self .llindex (0 ), self .llindex (0 )])
594
596
llexnname = self .llbuilder .load (llexnnameptr )
595
597
596
598
for target , typ in insn .clauses ():
@@ -602,11 +604,15 @@ def process_LandingPad(self, insn):
602
604
ir .Constant (typ .name , ir .TExceptionTypeInfo ()))
603
605
lllandingpad .add_clause (ll .CatchClause (llclauseexnname ))
604
606
605
- llmatchingclause = self .llbuilder .icmp_unsigned ('==' , llexnname , llclauseexnname )
606
- with self .llbuilder .if_then (llmatchingclause ):
607
+ if typ is None :
607
608
self .llbuilder .branch (self .map (target ))
609
+ else :
610
+ llmatchingclause = self .llbuilder .icmp_unsigned ('==' , llexnname , llclauseexnname )
611
+ with self .llbuilder .if_then (llmatchingclause ):
612
+ self .llbuilder .branch (self .map (target ))
608
613
609
- self .llbuilder .resume (lllandingpad )
614
+ if self .llbuilder .basic_block .terminator is None :
615
+ self .llbuilder .resume (lllandingpad )
610
616
611
- return lllandingpad
617
+ return llexn
612
618
0 commit comments