[llvm-bugs] [Bug 38340] New: Bogus __llvm_profile_data for __llvm_profile_runtime_user

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jul 27 08:59:19 PDT 2018


            Bug ID: 38340
           Summary: Bogus __llvm_profile_data for
           Product: new-bugs
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dmajor at mozilla.com
                CC: davidxl at google.com, llvm-bugs at lists.llvm.org,
                    rnk at google.com

A PGO-instrumented DLL on Windows has static initializers that go like:

00007ffa`4eb1e234 488d0de5ffffff  lea     rcx,[nss3!_llvm_profile_runtime_user
00007ffa`4eb1e23b e820ab0e00      call    nss3!__llvm_profile_register_function
00007ffa`4eb1e240 488d0db9ec1800  lea     rcx,[nss3!_profd_sprintf
00007ffa`4eb1e247 e814ab0e00      call    nss3!__llvm_profile_register_function
00007ffa`4eb1e24c 488d0dddec1800  lea     rcx,[nss3!_profd_vsprintf
00007ffa`4eb1e253 e808ab0e00      call    nss3!__llvm_profile_register_function
[...many more...]

The ones for sprintf and friends look fine, but the registration for
__llvm_profile_runtime_user contains garbage:

0:000> dt nss3!__llvm_profile_data 00007ffa`4eb1e220
   +0x000 NameRef          : 0xccc30013`514a058b
   +0x008 FuncHash         : 0xcccccccc`cccccccc
   +0x010 CounterPtr       : 0xe50d8d48`28ec8348 Void
   +0x018 FunctionPointer  : 0x000eab20`e8ffffff Void
   +0x020 Values           : 0xe80018ec`b90d8d48 Void
   +0x028 NumCounters      : 0xeab14
   +0x02c NumValueSites    : [2] 0x8d48

I'm not even sure if __llvm_profile_runtime_user is supposed to be registered
here at all. It's not a __profd_... thing.

The list of registrations seems to come from `for (Value *Data : UsedVars)` in

But there's a special case for `if (Data != NamesVar)` which suggests that
maybe not everything in `UsedVars` should be registered as a function.

Looking at the callers of `UsedVars.push_back`:

Maybe `VNodesVar` and `User` should be avoided in that for-loop too?

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180727/06b611a1/attachment.html>

More information about the llvm-bugs mailing list