[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;
+
+  for (auto &BB : *F) {
+    auto *Ins = CtxProfAnalysis::getBBInstrumentation(BB);
----------------
boomanaiden154 wrote:

Explicitly type this instruction?

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


More information about the llvm-commits mailing list