[PATCH] D63155: [clang][NewPM] Fix broken profile test

Leonard Chan via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 28 16:57:30 PDT 2019


leonardchan added a comment.

> I mean, I'm happy for the patch to be reverted, but I still really don't understand why this fixes the test to work *exactly* the same as w/ the old pass manager and doesn't break any other tests if it is completely wrong? It seems like there must be something strange with the test coverage if this is so far off of correct without any failures...
> 
> I also don't understand what fix you are suggesting instead, but maybe you can show a patch?

This is also the fix I'm suggesting.

  diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
  index 5d66473e7b9..f924ecbd8c6 100644
  --- a/clang/lib/CodeGen/BackendUtil.cpp
  +++ b/clang/lib/CodeGen/BackendUtil.cpp
  @@ -1220,12 +1220,13 @@ void EmitAssemblyHelper::EmitAssemblyWithNewPassManager(
         }
       }
   
  -    if (CodeGenOpts.OptimizationLevel == 0)
  +    if (CodeGenOpts.OptimizationLevel == 0) {
         addSanitizersAtO0(MPM, TargetTriple, LangOpts, CodeGenOpts);
   
  -    if (CodeGenOpts.hasProfileIRInstr()) {
  -      // This file is stored as the ProfileFile.
  -      MPM.addPass(PGOInstrumentationGenCreateVar(PGOOpt->ProfileFile));
  +      if (CodeGenOpts.hasProfileIRInstr()) {
  +        // This file is stored as the ProfileFile.
  +        MPM.addPass(PGOInstrumentationGenCreateVar(PGOOpt->ProfileFile));
  +      }
       }
     }


Repository:
  rL LLVM

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

https://reviews.llvm.org/D63155





More information about the cfe-commits mailing list