diff --git a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index fbf9688ed2d1eb3..278245c6dd2b101 100644 --- a/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -1855,10 +1855,7 @@ static bool InstrumentAllFunctions( instrumentOneFunc(F, &M, TLI, BPI, BFI, ComdatMembers, IsCS); AnythingInstrumented = true; } - if (!AnythingInstrumented) - return false; - - return true; + return AnythingInstrumented; } PreservedAnalyses diff --git a/llvm/unittests/Transforms/Instrumentation/PGOInstrumentationTest.cpp b/llvm/unittests/Transforms/Instrumentation/PGOInstrumentationTest.cpp index cbeaa501d4d88b0..8a8a06f42f9cb7a 100644 --- a/llvm/unittests/Transforms/Instrumentation/PGOInstrumentationTest.cpp +++ b/llvm/unittests/Transforms/Instrumentation/PGOInstrumentationTest.cpp @@ -180,7 +180,7 @@ TEST_P(PGOInstrumentationGenInstrumentTest, Instrumented) { const auto *IRInstrVar = M->getNamedGlobal(INSTR_PROF_QUOTE(INSTR_PROF_RAW_VERSION_VAR)); - EXPECT_THAT(IRInstrVar, NotNull()); + ASSERT_THAT(IRInstrVar, NotNull()); EXPECT_FALSE(IRInstrVar->isDeclaration()); } @@ -217,7 +217,7 @@ TEST_P(PGOInstrumentationGenIgnoreTest, NotInstrumented) { const auto *IRInstrVar = M->getNamedGlobal(INSTR_PROF_QUOTE(INSTR_PROF_RAW_VERSION_VAR)); - EXPECT_THAT(IRInstrVar, NotNull()); + ASSERT_THAT(IRInstrVar, NotNull()); EXPECT_FALSE(IRInstrVar->isDeclaration()); }