Page MenuHomePhabricator

[IRSim][IROutliner] Treating Called Functions as Values and Outlining Indirect Calls
ClosedPublic

Authored by AndrewLitteken on Sep 8 2021, 9:47 AM.

Details

Summary

The outliner currently requires that function calls not be indirect calls, and have that the function name, and function type must match, as well as other attributes such as calling conventions. This patch treats called functions as values, and just another operand, and named function calls as constants. This allows functions to be treated like any other constant, or input and output into the outlined functions.

There are also debugging flags added to enforce the old behaviors where indirect calls not be allowed, and to enforce the old rule that function calls names must also match.

Diff Detail

Event Timeline

AndrewLitteken created this revision.Sep 8 2021, 9:47 AM
AndrewLitteken requested review of this revision.Sep 8 2021, 9:47 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 8 2021, 9:47 AM
paquette added inline comments.Sep 10 2021, 4:24 PM
llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
132
133

Can the comment include what this actually is used for?

209

Can the comment explain why you would/wouldn't match by name?

Updating details in the comments.

jroelofs added inline comments.Sep 14 2021, 8:53 AM
llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
139

I think CalleeName would be a better name for this.

215

Likewise, this should probably be: setCalleeName

Changing name of function.

paquette accepted this revision.Dec 20 2021, 3:55 PM

I mostly have nits at this point, so I think this is more or less good to go.

llvm/include/llvm/Analysis/IRSimilarityIdentifier.h
521–524

Pull CI.isIndirectCall() into a variable?

llvm/include/llvm/Transforms/IPO/IROutliner.h
370

Pull CI.isIndirectCall() into a variable?

llvm/lib/Analysis/IRSimilarityIdentifier.cpp
117

Why not replace this with a getCalleeName function? That could also assert that you actually did set the callee name as well.

197–198

Shouldn't this comment say "if the instructions are function calls"?

This revision is now accepted and ready to land.Dec 20 2021, 3:55 PM

updating nits

paquette accepted this revision.Jan 4 2022, 11:26 AM

LGTM with typo fix

llvm/lib/Analysis/IRSimilarityIdentifier.cpp
141–143
This revision was landed with ongoing or failed builds.Jan 25 2022, 1:21 PM
This revision was automatically updated to reflect the committed changes.