Page MenuHomePhabricator

Map Parameters marked as dereferenceable during inlining to loads.
Needs RevisionPublic

Authored by mcberg2017 on Feb 18 2021, 3:39 PM.

Details

Summary

If a call has a Dereferenceable parameter and the call site provides
a pointer load to that parameter, walk all load's uses and validate
that all the calls we find have at least one parameter which
shares this property and matches the same definition.

I have done this as an existence walk, but it could just as easily be an intersection
of all the loads parameters that are used in calls.

Diff Detail

Event Timeline

mcberg2017 created this revision.Feb 18 2021, 3:39 PM
mcberg2017 requested review of this revision.Feb 18 2021, 3:39 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 18 2021, 3:39 PM
jdoerfert requested changes to this revision.EditedFeb 18 2021, 3:50 PM

I doubt this is correct. One problem below, one inlined.

int callee(int *a) { return *a; }
void caller(int **p, int c) {
  int *a = *p;
  if (c)
    callee(a);
}
llvm/lib/Transforms/Utils/InlineFunction.cpp
1678

I don't understand how we can ignore non call uses but somehow need a property of call uses, I'm fairly certain a simple bitcast will break this.

This revision now requires changes to proceed.Feb 18 2021, 3:50 PM