[llvm] [SandboxIR] Implement CatchReturnInst (PR #105605)

Jorge Gorbe Moya via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 22 15:58:57 PDT 2024


================
@@ -1957,6 +1957,71 @@ define void @foo() {
 #endif // NDEBUG
 }
 
+TEST_F(SandboxIRTest, CatchReturnInst) {
+  parseIR(C, R"IR(
+define void @foo() {
+dispatch:
+  %cs = catchswitch within none [label %catch] unwind to caller
+catch:
+  %catchpad = catchpad within %cs [ptr @foo]
+  catchret from %catchpad to label %continue
+continue:
+  ret void
+catch2:
+  %catchpad2 = catchpad within %cs [ptr @foo]
+  ret void
+}
+)IR");
+  Function &LLVMF = *M->getFunction("foo");
+  BasicBlock *LLVMCatch = getBasicBlockByName(LLVMF, "catch");
+  auto LLVMIt = LLVMCatch->begin();
+  [[maybe_unused]] auto *LLVMCP = cast<llvm::CatchPadInst>(&*LLVMIt++);
----------------
slackito wrote:

Do we need to keep those [[maybe_unused]] locals around? (same for the test in TrackerTest.cpp)

https://github.com/llvm/llvm-project/pull/105605


More information about the llvm-commits mailing list