This is an archive of the discontinued LLVM Phabricator instance.

[IRSim] Letting call instructions be legal for similarity identification.
ClosedPublic

Authored by AndrewLitteken on Sep 8 2020, 11:41 AM.

Details

Summary

Here we let non-intrinsic calls be considered legal and valid for similarity only if the call is not indirect, and has a name.

For two calls to be considered similar, they must have the same name, the same function types, and the same set of parameters, including tail calls and calling conventions.

Tests are found in unittests/Analysis/IRSimilarityIdentifierTest.cpp.

Diff Detail

Event Timeline

AndrewLitteken created this revision.Sep 8 2020, 11:41 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2020, 11:41 AM
jroelofs added inline comments.
llvm/lib/Analysis/IRSimilarityIdentifier.cpp
142

Maybe you ought to have a test that exercises the indirect call case, since getCalledFunction() will return nullptr for that.

Might also be useful to define a short helper function that extracts the name, since you'll be repeating the same logic twice for A/B.

Helper functions and nullptr checking for Call Instructions.

jroelofs accepted this revision.Sep 15 2020, 10:13 AM

LGTM

llvm/lib/Analysis/IRSimilarityIdentifier.cpp
52

static StringRef

146

could sink the assert into the helper, which dedupes this a bit more.

llvm/unittests/Analysis/IRSimilarityIdentifierTest.cpp
933

same what?

This revision is now accepted and ready to land.Sep 15 2020, 10:13 AM