File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed 
lib/CIR/Dialect/Transforms Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -606,10 +606,12 @@ class CIRTryOpFlattening : public mlir::OpRewritePattern<cir::TryOp> {
606606    //  `cir.try_call`.
607607    llvm::SmallVector<cir::CallOp, 4 > callsToRewrite;
608608    tryOp.getTryRegion ().walk ([&](CallOp op) {
609+       if  (op.getNothrow ())
610+         return ;
611+ 
609612      //  Only grab calls within immediate closest TryOp scope.
610613      if  (op->getParentOfType <cir::TryOp>() != tryOp)
611614        return ;
612-       assert (!cir::MissingFeatures::opCallExceptionAttr ());
613615      callsToRewrite.push_back (op);
614616    });
615617
Original file line number Diff line number Diff line change @@ -164,3 +164,33 @@ void try_catch_with_alloca() {
164164//  OGCG: %[[TMP_B:.*]] = load i32, ptr %[[B_ADDR]], align 4
165165//  OGCG: %[[RESULT:.*]] = add nsw i32 %[[TMP_A]], %[[TMP_B]]
166166//  OGCG: store i32 %[[RESULT]], ptr %[[C_ADDR]], align 4
167+ 
168+ void  function_with_noexcept () noexcept ;
169+ 
170+ void  calling_noexcept_function_inside_try_block () {
171+   try  {
172+     function_with_noexcept ();
173+   } catch  (...) {
174+   }
175+ }
176+ 
177+ //  CIR: cir.scope {
178+ //  CIR:   cir.try {
179+ //  CIR:     cir.call @_Z22function_with_noexceptv() nothrow : () -> ()
180+ //  CIR:     cir.yield
181+ //  CIR:   }
182+ //  CIR: }
183+ 
184+ //  LLVM:   br label %[[LABEL_1:.*]]
185+ //  LLVM: [[LABEL_1]]:
186+ //  LLVM:   br label %[[LABEL_2:.*]]
187+ //  LLVM: [[LABEL_2]]:
188+ //  LLVM:   call void @_Z22function_with_noexceptv()
189+ //  LLVM:   br label %[[LABEL_3:.*]]
190+ //  LLVM: [[LABEL_3]]:
191+ //  LLVM:   br label %[[LABEL_4:.*]]
192+ //  LLVM: [[LABEL_4]]:
193+ //  LLVM:   ret void
194+ 
195+ //  OGCG: call void @_Z22function_with_noexceptv()
196+ //  OGCG: ret void
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments