File tree Expand file tree Collapse file tree 3 files changed +3
-48
lines changed Expand file tree Collapse file tree 3 files changed +3
-48
lines changed Original file line number Diff line number Diff line change @@ -1523,21 +1523,8 @@ LogicalResult ReturnOp::verify() {
1523
1523
// ===----------------------------------------------------------------------===//
1524
1524
1525
1525
LogicalResult ResumeOp::verify () {
1526
- auto parentFunc = getOperation ()->getParentOfType <FunctionOpInterface>();
1527
- assert (parentFunc && " Expecting parent function" );
1528
- const auto ty = getOperand ().getType ();
1529
- if (!parentFunc
1530
- ->walk ([ty](LandingpadOp landingpad) {
1531
- return landingpad.getType () == ty
1532
- ? WalkResult::interrupt () // Just an operation needed
1533
- : WalkResult::advance ();
1534
- })
1535
- .wasInterrupted ()) {
1536
- // No operation was found: emit error
1537
- return emitOpError (" expects landingpad operation in the same function and "
1538
- " with the same type as this operation's operand" );
1539
- }
1540
-
1526
+ if (!getValue ().getDefiningOp <LandingpadOp>())
1527
+ return emitOpError (" expects landingpad value as operand" );
1541
1528
// No check for personality of function - landingpad op verifies it.
1542
1529
return success ();
1543
1530
}
Original file line number Diff line number Diff line change @@ -798,18 +798,7 @@ llvm.func @caller(%arg0: i32) -> i32 attributes { personality = @__gxx_personali
798
798
llvm.return %0 : i32
799
799
^bb2 : // pred: ^bb0
800
800
%2 = llvm.landingpad cleanup : !llvm.struct <(ptr , i32 )>
801
- // expected-error@+1 {{'llvm.resume' op expects landingpad operation in the same function and with the same type as this operation's operand}}
802
- llvm.resume %0 : i32
803
- }
804
-
805
- // -----
806
-
807
- llvm.func @foo (i32 ) -> i32
808
- llvm.func @__gxx_personality_v0 (...) -> i32
809
-
810
- llvm.func @caller (%arg0: i32 ) -> i32 attributes { personality = @__gxx_personality_v0 } {
811
- %0 = llvm.mlir.constant (1 : i32 ) : i32
812
- // expected-error@+1 {{'llvm.resume' op expects landingpad operation in the same function and with the same type as this operation's operand}}
801
+ // expected-error@+1 {{'llvm.resume' op expects landingpad value as operand}}
813
802
llvm.resume %0 : i32
814
803
}
815
804
Original file line number Diff line number Diff line change @@ -427,27 +427,6 @@ llvm.func @invokeLandingpad() -> i32 attributes { personality = @__gxx_personali
427
427
llvm.return %0 : i32
428
428
}
429
429
430
- llvm.func @foo2 () -> !llvm.struct <(ptr <i8 >, i32 )>
431
-
432
- // CHECK-LABEL: llvm.func @resumeNoLandingpadValue(
433
- // CHECK-SAME: %[[ARG:.*]]: i32)
434
- llvm.func @resumeNoLandingpadValue (%arg0: i32 ) -> i32 attributes { personality = @__gxx_personality_v0 } {
435
- // CHECK: %[[VAL_0:.*]] = llvm.call @foo2() : () -> !llvm.struct<(ptr<i8>, i32)>
436
- // CHECK: %[[VAL_1:.*]] = llvm.invoke @foo(%[[ARG]]) to ^[[BB1:.*]] unwind ^[[BB2:.*]] : (i32) -> i32
437
- %0 = llvm.call @foo2 () : () -> !llvm.struct <(ptr <i8 >, i32 )>
438
- %1 = llvm.invoke @foo (%arg0 ) to ^bb1 unwind ^bb2 : (i32 ) -> i32
439
- // CHECK: ^[[BB1]]:
440
- // CHECK: llvm.return %[[VAL_1]] : i32
441
- ^bb1 : // pred: ^bb0
442
- llvm.return %1 : i32
443
- // CHECK: ^[[BB2]]:
444
- // CHECK: %[[VAL_2:.*]] = llvm.landingpad cleanup : !llvm.struct<(ptr<i8>, i32)>
445
- // CHECK: llvm.resume %[[VAL_0]] : !llvm.struct<(ptr<i8>, i32)>
446
- ^bb2 : // pred: ^bb0
447
- %2 = llvm.landingpad cleanup : !llvm.struct <(ptr <i8 >, i32 )>
448
- llvm.resume %0 : !llvm.struct <(ptr <i8 >, i32 )>
449
- }
450
-
451
430
// CHECK-LABEL: @useFreezeOp
452
431
func.func @useFreezeOp (%arg0: i32 ) {
453
432
// CHECK: = llvm.freeze %[[ARG0:.*]] : i32
You can’t perform that action at this time.
0 commit comments