Author: Tom Stellard
Date: 2020-12-21T15:13:10-08:00
New Revision: 4ad0cfd4de414f9bedf48ec1034e663fe59efee4

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

LOG: llvm-profgen: Parse command line arguments after initializing targets

I am experimenting with turning backends into loadable modules and in
that scenario, target specific command line arguments won't be available
until after the targets are initialized.

Also, most other tools initialize targets before parsing arguments.

Reviewed By: wlei

Differential Revision: https://reviews.llvm.org/D93348

Added: 
    

Modified: 
    llvm/tools/llvm-profgen/llvm-profgen.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/tools/llvm-profgen/llvm-profgen.cpp 
b/llvm/tools/llvm-profgen/llvm-profgen.cpp
index 665ee7c791a7..0f4d8f015439 100644
--- a/llvm/tools/llvm-profgen/llvm-profgen.cpp
+++ b/llvm/tools/llvm-profgen/llvm-profgen.cpp
@@ -35,13 +35,13 @@ using namespace sampleprof;
 int main(int argc, const char *argv[]) {
   InitLLVM X(argc, argv);
 
-  cl::ParseCommandLineOptions(argc, argv, "llvm SPGO profile generator\n");
-
   // Initialize targets and assembly printers/parsers.
   InitializeAllTargetInfos();
   InitializeAllTargetMCs();
   InitializeAllDisassemblers();
 
+  cl::ParseCommandLineOptions(argc, argv, "llvm SPGO profile generator\n");
+
   // Load binaries and parse perf events and samples
   PerfReader Reader(BinaryFilenames);
   Reader.parsePerfTraces(PerfTraceFilenames);


        
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to