[llvm] [SandboxIR] Implement UnreachableInst (PR #101856)
via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 6 18:48:08 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()
+ unreachable
+ ret void
----------------
vporpo wrote:
I think I figured out what the problem was. `unreachable` seemed to terminate the BB and a new BB would start right after it that includes only `ret void`. So while iterating over the instructions starting from `unreachable` we would just go out of bounds right away.
The easiest solution seems to just drop the `ret void` line.
https://github.com/llvm/llvm-project/pull/101856
More information about the llvm-commits
mailing list