[PATCH] D149324: [PGO] Minor instrumentation code cleanup (NFC)

Jorge Gorbe Moya via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 13:16:31 PDT 2023


jgorbe added inline comments.


================
Comment at: llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp:725
     return;
-  std::string OrigName = F.getName().str();
+  StringRef OrigName = F.getName();
   std::string NewFuncName =
----------------
Dinistro wrote:
> jgorbe wrote:
> > I'm seeing a test failure on test/Transforms/PGOProfile/comdat_rename.ll in our internal buils, that bisects to this patch:
> > ```
> > error: CHECK: expected string not found in input
> > ; CHECK: @f = weak alias void (), ptr @f.[[SINGLEBB_HASH]]
> >          ^
> > <stdin>:15:37: note: scanning from here
> > $aef.742261418966908927 = comdat any
> >                                     ^
> > <stdin>:15:37: note: with "SINGLEBB_HASH" equal to "742261418966908927"
> > $aef.742261418966908927 = comdat any
> >                                     ^
> > <stdin>:30:2: note: possible intended match here
> > @"\CD" = weak alias void (), ptr @f.742261418966908927
> >  ^
> > ```
> > 
> > Unfortunately, I haven't been able to reproduce in my clone of upstream sources so I don't have any easy repro instructions yet. Turning `OrigName` back into a `std::string` fixes the problem for me, and I believe (but haven't confirmed yet) that the problem comes because `OrigName` is now a reference to `F.getName()`, but then we call `F.setName()` and invalidate the reference before calling `GlobalAlias::create`. Possibly the debug standard library in my failing build is writing 0xCD into the deleted buffer to mark it as invalid, causing the `@f`/`@"\CD"` mismatch reported by the test.
> Sorry for the inconvenience and thanks for hunting down the bug. Should be fixed in https://reviews.llvm.org/rGc67079f1be713fa558b3773562bd1eeb156cadbd
Thank you!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149324/new/

https://reviews.llvm.org/D149324



More information about the llvm-commits mailing list