[llvm] [ctx_prof] Don't use `GENERATE_DRIVER` (PR #100777)

Mircea Trofin via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 26 10:07:32 PDT 2024


https://github.com/mtrofin created https://github.com/llvm/llvm-project/pull/100777

Follow-up from PR #100379 (https://github.com/llvm/llvm-project/pull/100379#discussion_r1693120915)

>From e5c7106e76398911be4aa8bd31bdf02e42f04aa6 Mon Sep 17 00:00:00 2001
From: Mircea Trofin <mtrofin at google.com>
Date: Fri, 26 Jul 2024 10:06:10 -0700
Subject: [PATCH] [ctx_prof] Don't use `GENERATE_DRIVER`

Follow-up from PR #100379 (https://github.com/llvm/llvm-project/pull/100379#discussion_r1693120915)
---
 llvm/tools/llvm-ctxprof-util/CMakeLists.txt        | 1 -
 llvm/tools/llvm-ctxprof-util/llvm-ctxprof-util.cpp | 8 ++++----
 2 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/llvm/tools/llvm-ctxprof-util/CMakeLists.txt b/llvm/tools/llvm-ctxprof-util/CMakeLists.txt
index abf8e1aa0651f..4814c9941da5a 100644
--- a/llvm/tools/llvm-ctxprof-util/CMakeLists.txt
+++ b/llvm/tools/llvm-ctxprof-util/CMakeLists.txt
@@ -10,5 +10,4 @@ llvm-ctxprof-util.cpp
 
   DEPENDS
   intrinsics_gen
-  GENERATE_DRIVER
   )
diff --git a/llvm/tools/llvm-ctxprof-util/llvm-ctxprof-util.cpp b/llvm/tools/llvm-ctxprof-util/llvm-ctxprof-util.cpp
index ded8c8a6e4332..3bb7681e33a87 100644
--- a/llvm/tools/llvm-ctxprof-util/llvm-ctxprof-util.cpp
+++ b/llvm/tools/llvm-ctxprof-util/llvm-ctxprof-util.cpp
@@ -19,8 +19,8 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Error.h"
 #include "llvm/Support/ErrorHandling.h"
+#include "llvm/Support/InitLLVM.h"
 #include "llvm/Support/JSON.h"
-#include "llvm/Support/LLVMDriver.h"
 #include "llvm/Support/MemoryBuffer.h"
 #include "llvm/Support/raw_ostream.h"
 
@@ -132,7 +132,7 @@ Error convertFromJSON() {
   return Error::success();
 }
 
-int llvm_ctxprof_util_main(int argc, char **argv, const llvm::ToolContext &) {
+int main(int argc, const char **argv) {
   cl::ParseCommandLineOptions(argc, argv, "LLVM Contextual Profile Utils\n");
   ExitOnError ExitOnErr("llvm-ctxprof-util: ");
   if (FromJSON) {
@@ -145,6 +145,6 @@ int llvm_ctxprof_util_main(int argc, char **argv, const llvm::ToolContext &) {
     }
     return 0;
   }
-  llvm_unreachable("Unknown subcommands should have been handled by the "
-                   "command line parser.");
+  cl::PrintHelpMessage();
+  return 1;
 }



More information about the llvm-commits mailing list