This is an archive of the discontinued LLVM Phabricator instance.

[ELF] Don't warn on two legitimate cases when reading .llvm.call-graph-profile
ClosedPublic

Authored by MaskRay on Oct 19 2018, 9:06 PM.

Details

Summary

Before, superfluous warnings were emitted for the following two cases:

  1. When from symbol was in a discarded section. The profile should be thought of as affiliated to the section. It makes sense to ignore the profile if the section is discarded.
  1. When to symbol was in a shared object. The object file containing the profile may not know about the to symbol, which can reside in another object file (useful profile) or a shared object (not useful as symbols in the shared object are fixed and unorderable). It makes sense to ignore the profile from the object file.

    Note, the warning when to symbol was undefined was suppressed in D53044, which is still useful for --symbol-ordering-file=

This patch silences the warnings. The check is actually more relaxed (no
warnings if either From or To is not Defined) for simplicity and I don't
see a compelling reason to warn on more cases.

Diff Detail

Repository
rL LLVM

Event Timeline

MaskRay created this revision.Oct 19 2018, 9:06 PM
ruiu added inline comments.Oct 22 2018, 1:57 PM
ELF/Driver.cpp
687–688 ↗(On Diff #170300)

SymD -> Sym

691 ↗(On Diff #170300)

SB -> Sec

by convention.

693 ↗(On Diff #170300)

This needs a comment.

MaskRay updated this revision to Diff 170493.Oct 22 2018, 2:14 PM

Add comments

MaskRay updated this revision to Diff 170497.Oct 22 2018, 2:24 PM

Improve the comment

ruiu added inline comments.Oct 22 2018, 2:25 PM
ELF/Driver.cpp
693 ↗(On Diff #170497)

When you write a multi-line comment, please add a blank line before first line.

696 ↗(On Diff #170497)

You generally shouldn't break a line before ")".

MaskRay updated this revision to Diff 170504.Oct 22 2018, 2:49 PM

Fix comment as ruiu@ suggested

ruiu added inline comments.Oct 22 2018, 3:03 PM
test/ELF/cgprofile-shared-warn.s
7 ↗(On Diff #170504)

cgprofile-shared-warn.s is very small. Can you avoid checking in that file by doing this?

echo '.globl B; B: ret' | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %t1.o
MaskRay updated this revision to Diff 170510.Oct 22 2018, 3:15 PM

Inline Inputs/cgprofile-shared-warn.s

MaskRay marked 5 inline comments as done.Oct 22 2018, 3:17 PM
ruiu accepted this revision.Oct 22 2018, 4:25 PM

LGTM

This revision is now accepted and ready to land.Oct 22 2018, 4:25 PM
This revision was automatically updated to reflect the committed changes.