[llvm-branch-commits] [llvm] c8faaf9 - [llubi] Don't check type after the program exited (#201862)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Jun 5 09:27:19 PDT 2026


Author: Yingwei Zheng
Date: 2026-06-05T15:47:34Z
New Revision: c8faaf9a9ef24873fe97d46554ad5fb909d0fd5d

URL: https://github.com/llvm/llvm-project/commit/c8faaf9a9ef24873fe97d46554ad5fb909d0fd5d
DIFF: https://github.com/llvm/llvm-project/commit/c8faaf9a9ef24873fe97d46554ad5fb909d0fd5d.diff

LOG: [llubi] Don't check type after the program exited (#201862)

Closes https://github.com/llvm/llvm-project/issues/201791.

Added: 
    llvm/test/tools/llubi/call_unknown.ll

Modified: 
    llvm/tools/llubi/lib/Interpreter.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llubi/call_unknown.ll b/llvm/test/tools/llubi/call_unknown.ll
new file mode 100644
index 0000000000000..7943385809025
--- /dev/null
+++ b/llvm/test/tools/llubi/call_unknown.ll
@@ -0,0 +1,12 @@
+; NOTE: Assertions have been autogenerated by utils/update_llubi_test_checks.py UTC_ARGS: --version 6
+; RUN: not llubi --verbose < %s 2>&1 | FileCheck %s
+
+declare i32 @unknown()
+
+define i32 @main() {
+  %res = call i32 @unknown()
+  ret i32 %res
+}
+; CHECK: Entering function: main
+; CHECK-NEXT: Unrecognized instruction:   %res = call i32 @unknown()
+; CHECK-NEXT: error: Execution of function 'main' failed.

diff  --git a/llvm/tools/llubi/lib/Interpreter.cpp b/llvm/tools/llubi/lib/Interpreter.cpp
index 81cc968535a2f..90d1966422a4c 100644
--- a/llvm/tools/llubi/lib/Interpreter.cpp
+++ b/llvm/tools/llubi/lib/Interpreter.cpp
@@ -168,6 +168,8 @@ class InstExecutor : public InstVisitor<InstExecutor, void>,
   void setResult(Instruction &I, AnyValue V) {
     if (!hasProgramExited() && !Handler.onInstructionExecuted(I, V))
       setFailed();
+    if (hasProgramExited())
+      return;
     assert(V.isCompatibleWith(I.getType()) && "Unexpected value storage kind.");
     if (!V.isNone())
       CurrentFrame->ValueMap.insert_or_assign(&I, std::move(V));


        


More information about the llvm-branch-commits mailing list