[LLVMdev] mem2reg optimization

Dan Gohman gohman at apple.com
Tue Oct 7 10:37:44 PDT 2008

On Tue, October 7, 2008 9:02 am, David Greene wrote:
> On Tuesday 07 October 2008 00:32, Nicolas Capens wrote:
>> Anyway, this can definitely also be done with an analysis pass that
>> provides information about ordering between loads and stores. It's just
> Actually, no it can't.  See the thread about analysis passes depending on
> other analysis passes and when things do and don't get updated by
> PassManager.

How is this relevant? It sounds like what's needed are orderings
of loads and stores within each block. What other analyses would
such an analysis depend on?

I don't think an analysis pass is necessarily the best way to go
here. If it's easier for mem2reg to just keep track of what it needs
on its own that's fine. Making a pass would be useful if the
information would help other passes as well though.

Also, FWIW, this is a case where the terminology of analysis
"passes" and the general emphasis on "running" them is a little
misleading. Instead of having a runOnFunction that runs ahead and
precomputes information for the entire function, this kind of
analysis is a good match for the on-demand approach, where
runOnFunction does nothing, and information about each block is
computed the first time a query needs it.


More information about the llvm-dev mailing list