This is an archive of the discontinued LLVM Phabricator instance.

[PGO] Minor instrumentation code cleanup (NFC)
ClosedPublic

Authored by Dinistro on Apr 27 2023, 1:27 AM.

Details

Summary

This commit cleans up some parts of the PGO instrumentation. Most
importantly, it removes a template parameter shadowing of a class name
that could lead to confusion.

Diff Detail

Event Timeline

Dinistro created this revision.Apr 27 2023, 1:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2023, 1:27 AM
Dinistro requested review of this revision.Apr 27 2023, 1:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 27 2023, 1:27 AM
gysit accepted this revision.Apr 27 2023, 1:39 AM

LGTM!

This revision is now accepted and ready to land.Apr 27 2023, 1:39 AM
Dinistro updated this revision to Diff 517544.Apr 27 2023, 6:57 AM

Add BCI check to make this really NFC and, thus, fix the bolt builds.

The CI crash is caused by another change in bolt that only occurs sporadically. Potential causing revision: https://reviews.llvm.org/D149014

This revision was landed with ongoing or failed builds.Apr 27 2023, 9:10 AM
This revision was automatically updated to reflect the committed changes.
jgorbe added a subscriber: jgorbe.Apr 27 2023, 12:18 PM
jgorbe added inline comments.
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
725

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.

Dinistro marked an inline comment as done.Apr 27 2023, 12:44 PM
Dinistro added inline comments.
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
725

Sorry for the inconvenience and thanks for hunting down the bug. Should be fixed in https://reviews.llvm.org/rGc67079f1be713fa558b3773562bd1eeb156cadbd

jgorbe added inline comments.Apr 27 2023, 1:16 PM
llvm/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
725

Thank you!