[llvm-dev] [GSoC 2016] [Weekly Status] Interprocedural Register Allocation

Sanjoy Das via llvm-dev llvm-dev at lists.llvm.org
Mon Jun 20 12:53:16 PDT 2016


Hi Vivek,

vivek pandya via llvm-dev wrote:
 >     int foo() {
 >     return 12;
 >     }
 >
 >     int bar(int a) {
 >     return foo() + a;
 >     }
 >
 >     int (*fp)() = 0;
 >     int (*fp1)(int) = 0;
 >
 >     int main() {
 >     fp = foo;
 >     fp();
 >     fp1 = bar;
 >     fp1(15);
 >     return 0;
 >     }

IMO it is waste of time trying to do a better job at the IPRA level on
IR like the above ^.  LLVM should be folding the indirect calls to
direct calls at the IR level, and if it isn't that's a bug in the IR
level optimizer.

The interesting cases are when you have a call like:

   fnptr target = object->callback;
   target(foo, bar);

and the IR level optimizer has failed to optimize the indirect call to
`target` to a direct call.

-- Sanjoy


More information about the llvm-dev mailing list