[llvm] [ctx_prof] API to get the instrumentation of a BB (PR #105468)

Aiden Grossman via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 21 17:08:44 PDT 2024


================
@@ -132,4 +132,26 @@ TEST_F(CtxProfAnalysisTest, GetCallsiteIDNegativeTest) {
   EXPECT_EQ(IndIns, nullptr);
 }
 
+TEST_F(CtxProfAnalysisTest, GetBBIDTest) {
+  ModulePassManager MPM;
+  MPM.addPass(PGOInstrumentationGen(PGOInstrumentationType::CTXPROF));
+  EXPECT_FALSE(MPM.run(*M, MAM).areAllPreserved());
+  auto *F = M->getFunction("foo");
+  ASSERT_NE(F, nullptr);
+  std::map<std::string, int> BBNameAndID;
----------------
boomanaiden154 wrote:

It's a test and doesn't matter much, but should we more carefully choose the container here? It doesn't seem like the iteration order matters, so something like `std::unordered_map` might be better.

https://github.com/llvm/llvm-project/pull/105468


More information about the llvm-commits mailing list