[LLVMdev] region pass - new pass for llvm

Renato Golin rengolin at systemcall.org
Mon Mar 8 02:23:49 PST 2010


On 6 March 2010 02:05, Tobias Grosser <grosser at fim.uni-passau.de> wrote:
> This is useful if you want to restrict an analysis&transformation
> e.g. to side effect free code, code without loops, code without
> irregular control flow, ...

I'm confused...

I thought that loop optimization was one of the benefits of separating
a region from the rest of the code... Also, you can only guarantee
side effect free code if there is no function calls or the whole
program is running single threaded. SSA would guarantee all the other
cases.

I guess that the CFG would not be closed if there was a function call
(or a jump for that matter), but multi-threaded load/stores can't be
guaranteed. Even if you have locks, LLVM wouldn't be able to tell it's
a lock and for that particular variable. Or maybe we should just
ignore the case and let the programmer hang himself... ;)


> We will use it to extract regions with regular control flow that contain
> only loops and branches with affine linear expressions in the loop
> bounds or branch conditions. These are the regions that Polly
> (polyhedral optimizations for LLVM) should work on.

Ok, so this means you meant "code without non-affine loops", right?

Still, non-affine loops can be converted to affine loops in many ways
and would be easier to do so in a closed region rather than looking
again the same code poly has just seen, and converting loops to affine
could be easier if the region was closed (simpler dependency
analysis).

So, I wouldn't rule out any kind of loop in the poly pass, and keep a
flag to assert the region is "clean". The passes that need a clean
region should only pass after all "cleaning" passes (such as
'affine-zising' loops) had run and skip if the region is not clean.

cheers,
--renato

http://systemcall.org/

Reclaim your digital rights, eliminate DRM, learn more at
http://www.defectivebydesign.org/what_is_drm



More information about the llvm-dev mailing list