This is an archive of the discontinued LLVM Phabricator instance.

IR: Add entry/exit instrumentation symbols to the libcall list.
Needs RevisionPublic

Authored by pcc on Jul 30 2018, 2:55 PM.

Details

Summary

This is necessary in order for these symbols to be handled correctly
during LTO.

Diff Detail

Event Timeline

pcc created this revision.Jul 30 2018, 2:55 PM
tejohnson added inline comments.Aug 10 2018, 9:04 AM
llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
23

Can you include RuntimeLibcalls.def and assert that the name is in that list?

pcc added inline comments.Aug 10 2018, 9:41 AM
llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
23

I could, but I don't think we need to do that unless there's evidence that people are ignoring the comment.

tejohnson added inline comments.Aug 10 2018, 10:00 AM
llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
23

I'd prefer an assert, because I think it would be easy to miss the comment if the second if block is extended with another func name, or a subsequent new if block is added below it.

pcc marked an inline comment as done.Feb 14 2019, 2:14 PM
pcc added inline comments.
llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
23

How about just putting a comment in all the places where people are likely to add new code to this function (before ifs, at the end)?

Herald added a project: Restricted Project. · View Herald TranscriptFeb 14 2019, 2:14 PM
pcc marked an inline comment as done.Feb 14 2019, 2:30 PM
pcc added inline comments.
llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
23

I suppose another idea is to do something like

#define HANDLE_LIBCALL(name, value) const char LibCallName_##name[] = value;
#include "llvm/IR/RuntimeLibcalls.def"

in a header somewhere, and then change this code to use LibCallName_FOO.

Needs a test.

llvm/lib/Transforms/Utils/EntryExitInstrumenter.cpp
23

Sure that would work too (I was originally envisioning something like what is done in IRSymtab.cpp except assert that IsBuiltinFunc, but your idea is more efficient). Why would it need to be in a header rather than in this file?

Better to enforce consistency at compile time if possible IMO.

dexonsmith requested changes to this revision.Aug 26 2019, 11:17 AM

[Marking as "Request Changes" to get this out of my queue.]

This revision now requires changes to proceed.Aug 26 2019, 11:17 AM