From 4ad0cfd4de414f9bedf48ec1034e663fe59efee4 Mon Sep 17 00:00:00 2001 From: Tom Stellard Date: Mon, 21 Dec 2020 13:29:56 -0800 Subject: [PATCH] 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 --- llvm/tools/llvm-profgen/llvm-profgen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/tools/llvm-profgen/llvm-profgen.cpp b/llvm/tools/llvm-profgen/llvm-profgen.cpp index 665ee7c..0f4d8f0 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); -- 2.7.4