[PATCH] D156516: [lli] Fix crash on empty entry-function

Lang Hames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 28 10:12:43 PDT 2023


lhames accepted this revision.
lhames added a comment.
This revision is now accepted and ready to land.

Otherwise LGTM. Thanks @c-rhodes!



================
Comment at: llvm/test/ExecutionEngine/Orc/empty-entry-function.ll:6-9
+define i32 @main(i32 %argc, ptr %argv) {
+entry:
+  ret i32 0
+}
----------------
I think you can omit the IR entirely since you'll error out before attempting to parse it:
```
; RUN: not lli --entry-function= %s 2>&1 | FileCheck %s
;
; Test empty entry-function yield an error.
;
; CHECK: error: entry-function empty
```


================
Comment at: llvm/tools/lli/lli.cpp:449-452
+  if (EntryFunc.empty()) {
+    WithColor::error(errs(), argv[0]) << "entry-function empty\n";
+    exit(1);
+  }
----------------
Could you change the error message to "--entry-function name cannot be empty"?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D156516/new/

https://reviews.llvm.org/D156516



More information about the llvm-commits mailing list