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

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 6 18:55:28 PDT 2024


================
@@ -2037,3 +2037,33 @@ define void @foo(i32 %arg) {
   }
   EXPECT_EQ(NewPHI->getNumIncomingValues(), PHI->getNumIncomingValues());
 }
+
+TEST_F(SandboxIRTest, UnreachableInst) {
+  parseIR(C, R"IR(
+define void @foo() {
+  call void @llvm.donothing()
----------------
vporpo wrote:

The reason your test passed with the additional call instruction before `unreachable` was that you were iterating across: (i) the call and (ii) the unreachable, both of which are in the same block. 

In the previous version we were trying to iterate from (i) the unreachable to (ii) ret void, but these happened to be in different blocks.

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


More information about the llvm-commits mailing list