diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2022-01-27 22:06:42 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2022-01-27 22:06:42 +0000 | 
| commit | 6f8fc217eaa12bf657be1c6468ed9938d10168b3 (patch) | |
| tree | a1fd89b864d9b93e2ad68fe1dcf7afee2e3c8d76 /clang/lib/CodeGen/BackendUtil.cpp | |
| parent | 77fc4c146f0870ffb09c1afb823ccbe742c5e6ff (diff) | |
Diffstat (limited to 'clang/lib/CodeGen/BackendUtil.cpp')
| -rw-r--r-- | clang/lib/CodeGen/BackendUtil.cpp | 29 | 
1 files changed, 18 insertions, 11 deletions
| diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp index bacac0a20d4d..9ae5c870afc8 100644 --- a/clang/lib/CodeGen/BackendUtil.cpp +++ b/clang/lib/CodeGen/BackendUtil.cpp @@ -197,8 +197,7 @@ public:    PassManagerBuilderWrapper(const Triple &TargetTriple,                              const CodeGenOptions &CGOpts,                              const LangOptions &LangOpts) -      : PassManagerBuilder(), TargetTriple(TargetTriple), CGOpts(CGOpts), -        LangOpts(LangOpts) {} +      : TargetTriple(TargetTriple), CGOpts(CGOpts), LangOpts(LangOpts) {}    const Triple &getTargetTriple() const { return TargetTriple; }    const CodeGenOptions &getCGOpts() const { return CGOpts; }    const LangOptions &getLangOpts() const { return LangOpts; } @@ -359,7 +358,8 @@ static void addGeneralOptsForMemorySanitizer(const PassManagerBuilder &Builder,    int TrackOrigins = CGOpts.SanitizeMemoryTrackOrigins;    bool Recover = CGOpts.SanitizeRecover.has(SanitizerKind::Memory);    PM.add(createMemorySanitizerLegacyPassPass( -      MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel})); +      MemorySanitizerOptions{TrackOrigins, Recover, CompileKernel, +                             CGOpts.SanitizeMemoryParamRetval != 0}));    // MemorySanitizer inserts complex instrumentation that mostly follows    // the logic of the original code, but operates on "shadow" values. @@ -645,6 +645,7 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,    Options.MCOptions.CommandLineArgs = CodeGenOpts.CommandLineArgs;    Options.DebugStrictDwarf = CodeGenOpts.DebugStrictDwarf;    Options.ObjectFilenameForDebug = CodeGenOpts.ObjectFilenameForDebug; +  Options.Hotpatch = CodeGenOpts.HotPatch;    return true;  } @@ -1164,11 +1165,11 @@ static void addSanitizers(const Triple &TargetTriple,          int TrackOrigins = CodeGenOpts.SanitizeMemoryTrackOrigins;          bool Recover = CodeGenOpts.SanitizeRecover.has(Mask); -        MPM.addPass( -            ModuleMemorySanitizerPass({TrackOrigins, Recover, CompileKernel})); +        MemorySanitizerOptions options(TrackOrigins, Recover, CompileKernel, +                                       CodeGenOpts.SanitizeMemoryParamRetval); +        MPM.addPass(ModuleMemorySanitizerPass(options));          FunctionPassManager FPM; -        FPM.addPass( -            MemorySanitizerPass({TrackOrigins, Recover, CompileKernel})); +        FPM.addPass(MemorySanitizerPass(options));          if (Level != OptimizationLevel::O0) {            // MemorySanitizer inserts complex instrumentation that mostly            // follows the logic of the original code, but operates on @@ -1491,8 +1492,11 @@ void EmitAssemblyHelper::RunOptimizationPipeline(    }    // Now that we have all of the passes ready, run them. -  PrettyStackTraceString CrashInfo("Optimizer"); -  MPM.run(*TheModule, MAM); +  { +    PrettyStackTraceString CrashInfo("Optimizer"); +    llvm::TimeTraceScope TimeScope("Optimizer"); +    MPM.run(*TheModule, MAM); +  }  }  void EmitAssemblyHelper::RunCodegenPipeline( @@ -1524,8 +1528,11 @@ void EmitAssemblyHelper::RunCodegenPipeline(      return;    } -  PrettyStackTraceString CrashInfo("Code generation"); -  CodeGenPasses.run(*TheModule); +  { +    PrettyStackTraceString CrashInfo("Code generation"); +    llvm::TimeTraceScope TimeScope("CodeGenPasses"); +    CodeGenPasses.run(*TheModule); +  }  }  /// A clean version of `EmitAssembly` that uses the new pass manager. | 
