From 9c6f1538cc0f70fe43d47cf818ad797c82b61d5f Mon Sep 17 00:00:00 2001 From: Rong Xu Date: Wed, 2 Mar 2016 20:59:36 +0000 Subject: [PGO] Change profile use cc1 option to handle IR level profiles This patch changes cc1 option for PGO profile use from -fprofile-instr-use= to -fprofile-instrument-use-path=. -fprofile-instr-use= is now a driver only option. In addition to decouple the cc1 option from the driver level option, this patch also enables IR level profile use. cc1 option handling now reads the profile header and sets CodeGenOpt ProfileUse (valid values are {None, Clang, LLVM} -- this is a common enum for -fprofile-instrument={}, for the profile instrumentation), and invoke the pipeline to enable the respective PGO use pass. Reviewers: silvas, davidxl Differential Revision: http://reviews.llvm.org/D17737 llvm-svn: 262515 --- clang/lib/CodeGen/CodeGenModule.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index cf9e29d..7df9034 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -149,13 +149,13 @@ CodeGenModule::CodeGenModule(ASTContext &C, const HeaderSearchOptions &HSO, if (C.getLangOpts().ObjC1) ObjCData = new ObjCEntrypoints(); - if (!CodeGenOpts.InstrProfileInput.empty()) { - auto ReaderOrErr = - llvm::IndexedInstrProfReader::create(CodeGenOpts.InstrProfileInput); + if (CodeGenOpts.hasProfileClangUse()) { + auto ReaderOrErr = llvm::IndexedInstrProfReader::create( + CodeGenOpts.ProfileInstrumentUsePath); if (std::error_code EC = ReaderOrErr.getError()) { unsigned DiagID = Diags.getCustomDiagID(DiagnosticsEngine::Error, "Could not read profile %0: %1"); - getDiags().Report(DiagID) << CodeGenOpts.InstrProfileInput + getDiags().Report(DiagID) << CodeGenOpts.ProfileInstrumentUsePath << EC.message(); } else PGOReader = std::move(ReaderOrErr.get()); -- cgit v1.1