Index: lld/test/COFF/pgo-warn-mismatch.ll =================================================================== --- lld/test/COFF/pgo-warn-mismatch.ll +++ lld/test/COFF/pgo-warn-mismatch.ll @@ -6,9 +6,11 @@ ; Ensure lld generates warnings for profile cfg mismatch. ; RUN: lld-link /dll /noentry /export:f /lto-cs-profile-file:%t/cs.profdata /lto-pgo-warn-mismatch /opt:lldlto=2 %t/a.bc /out:%t/a.dll 2>&1 | FileCheck %s +; RUN: lld-link /lto-legacy-pass-manager:no /dll /noentry /export:f /lto-cs-profile-file:%t/cs.profdata /lto-pgo-warn-mismatch /opt:lldlto=2 %t/a.bc /out:%t/a.dll 2>&1 | FileCheck %s ; Ensure lld will not generate warnings for profile cfg mismatch. ; RUN: lld-link /dll /noentry /export:f /lto-cs-profile-file:%t/cs.profdata /lto-pgo-warn-mismatch:no /opt:lldlto=2 %t/a.bc /out:%t/a.dll 2>&1 | count 0 +; RUN: lld-link /lto-legacy-pass-manager:no /dll /noentry /export:f /lto-cs-profile-file:%t/cs.profdata /lto-pgo-warn-mismatch:no /opt:lldlto=2 %t/a.bc /out:%t/a.dll 2>&1 | count 0 ; CHECK: warning: {{.*}} function control flow change detected (hash mismatch) f Hash = [[#]] Index: lld/test/ELF/lto/pgo-warn-mismatch.ll =================================================================== --- lld/test/ELF/lto/pgo-warn-mismatch.ll +++ lld/test/ELF/lto/pgo-warn-mismatch.ll @@ -6,9 +6,11 @@ ;; Ensure lld generates warnings for profile cfg mismatch. ; RUN: ld.lld --lto-cs-profile-file=%t/cs.profdata --lto-pgo-warn-mismatch -shared %t/a.bc -o /dev/null 2>&1 | FileCheck %s +; RUN: ld.lld --no-lto-legacy-pass-manager --lto-cs-profile-file=%t/cs.profdata --lto-pgo-warn-mismatch -shared %t/a.bc -o /dev/null 2>&1 | FileCheck %s ;; Ensure lld will not generate warnings for profile cfg mismatch. ; RUN: ld.lld --lto-cs-profile-file=%t/cs.profdata --no-lto-pgo-warn-mismatch -shared --fatal-warnings %t/a.bc -o /dev/null +; RUN: ld.lld --no-lto-legacy-pass-manager --lto-cs-profile-file=%t/cs.profdata --no-lto-pgo-warn-mismatch -shared --fatal-warnings %t/a.bc -o /dev/null ; CHECK: warning: {{.*}} function control flow change detected (hash mismatch) f Hash = [[#]] Index: llvm/lib/LTO/LTOBackend.cpp =================================================================== --- llvm/lib/LTO/LTOBackend.cpp +++ llvm/lib/LTO/LTOBackend.cpp @@ -317,6 +317,8 @@ legacy::PassManager passes; passes.add(createTargetTransformInfoWrapperPass(TM->getTargetIRAnalysis())); + NoPGOWarnMismatch = !Conf.PGOWarnMismatch; + PassManagerBuilder PMB; PMB.LibraryInfo = new TargetLibraryInfoImpl(Triple(TM->getTargetTriple())); if (Conf.Freestanding)