[LLVMdev] Is there a "callback optimization"?
Duncan Sands
baldrick at free.fr
Fri Jun 4 09:11:08 PDT 2010
Hi Kenneth,
> By that I mean an optimization pass (or a combination of them) that turns:
...
> With that transform in place, lots of inlining becomes possible, and
> direct function calls replace indirect function calls if inlining
> isn't appropriate. If this transform is combined with argpromotion
> and scalarrepl, it can be used for devirtualization of C++ virtual
> function calls.
>
> There seems to be an awful lot of C++ code out there that uses
> templates to perform this same optimization in source code.
yes, LLVM does this. For example, running your example through the LLVM
optimizers gives:
define void @foo() nounwind readnone {
entry:
ret void
}
As you can see, the indirect function calls were resolved into direct
function calls and inlined.
I don't know which passes take care of this however.
Ciao,
Duncan.
More information about the llvm-dev
mailing list