[llvm] [SandboxIR] Implement UnreachableInst (PR #101856)

Julius Alexandre via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 3 22:38:09 PDT 2024


================
@@ -2037,3 +2037,31 @@ define void @foo(i32 %arg) {
   }
   EXPECT_EQ(NewPHI->getNumIncomingValues(), PHI->getNumIncomingValues());
 }
+
+TEST_F(SandboxIRTest, UnreachableInst) {
+  parseIR(C, R"IR(
+define void @foo() {
+  ret void
+  unreachable
+}
+)IR");
+  llvm::Function *LLVMF = &*M->getFunction("foo");
+  sandboxir::Context Ctx(C);
+  sandboxir::Function *F = Ctx.createFunction(LLVMF);
+  auto *BB = &*F->begin();
+  auto It = BB->begin();
+  auto *Ret = &*It++;
+  auto *UI = cast<sandboxir::UnreachableInst>(&*It++);
+
+  EXPECT_TRUE(llvm::isa<sandboxir::UnreachableInst>(UI));
----------------
medievalghoul wrote:

Done.

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


More information about the llvm-commits mailing list