[LLVMdev] PredicateSimplifier questions

Nick Lewycky nicholas at mxc.ca
Sun Feb 15 20:54:50 PST 2009


Hi John,

John Regehr wrote:
> PredicateSimplifier is a pretty interesting pass, but it doesn't look 
> like opt invokes it at any standard -Ox level, and so I assume that 
> llvm-gcc also does not use this pass?  If that is right, I'm curious 
> about why this is the case -- does it simply not provide enough code 
> speedup to compensate for the increase in compile time?

I wrote predsimplify as I was learning about compiler theory. It's 
pretty dumb in the sense that it spends lots of time analysing things 
that will never be used, and despite being the slowest pass in LLVM I 
haven't seen it improve run-times in a nightly test.

> Also, a colleague and I (we both teach advanced compiler courses) would 
> like to have a relatively easy way for students to try out various 
> abstract interpretation techniques on LLVM code.  Writing an abstract 
> interpreter from scratch has too much overhead.  Of the LLVM passes that 
> we know of, PredicateSimplifier seems the best starting point for making 
> a more generic abstract interpreter into which collections of transfer 
> functions could be plugged.  Does that seem right or can anyone suggest 
> a better starting point?  It would be pretty cool, for example, to see 
> what the Octagon domain could learn about LLVM programs.

Predsimplify is believed to have bugs (it results in miscompiled 
programs) and certainly isn't efficient (it was written before much of 
include/ADT). Finally, predsimplify is likely to go away once I or 
someone else writes a proper VRP pass.

The only other starting points I can suggest are the concrete 
interpreter in lib/ExecutionEngine/Interpreter and the sparse 
conditional propagation framework in Analysis/SparsePropagation.h.

If you decide that predsimplify is useful for you despite my warnings, 
then I would be very happy to hear that my time working on it wasn't all 
wasted!

Nick Lewycky



More information about the llvm-dev mailing list