[LLVMdev] How to make Polly ignore some non-affine memory accesses

Tobias Grosser tobias at grosser.es
Sun Oct 23 14:31:00 PDT 2011

On 10/22/2011 08:41 AM, Marcello Maggioni wrote:
> I was trying the new feature you introduce about printing out the
> graphs, so I updated my version of llvm/clang/polly synchronizing them
> to the last version, but I get this error launching clang (also , I
> recently switched to MacOS X for development):
> $ clang not_so_simple_loop.c -O3 -Xclang -load -Xclang
> ${PATH_TO_POLLY_LIB}/LLVMPolly.dylib -mllvm -enable-polly-viewer
> -mllvm -enable-iv-rewrite

I documented the use of Polly in clang on a new website:

> error: unable to load plugin
> '/Users/Kariddi/Documents/Sviluppo/Tesi/git-prefix/lib//LLVMPolly.dylib':
> 'dlopen(/Users/Kariddi/Documents/Sviluppo/Tesi/git-prefix/lib//LLVMPolly.dylib,
> 9): Symbol not found: __ZN4llvm10RegionInfo2IDE
>    Referenced from:
> /Users/Kariddi/Documents/Sviluppo/Tesi/git-prefix/lib//LLVMPolly.dylib
>    Expected in: flat namespace
>   in /Users/Kariddi/Documents/Sviluppo/Tesi/git-prefix/lib//LLVMPolly.dylib'
> clang (LLVM option parsing): Unknown command line argument
> '-enable-polly-viewer'.  Try: 'clang (LLVM option parsing) -help'
> clang (LLVM option parsing): Did you mean '-enable-ppc-preinc'?
> $ clang -v
> clang version 3.1 (trunk 142724)
> Target: x86_64-apple-darwin11.2.0
> Thread model: posix
> Seems like it tries to load a symbol that it doesn't find ...
> I have synchronized all clang/llvm/polly to the latest version and I
> compiled them all together. Loading polly with "opt" works strangely
> ... :
> opt -S -load ${PATH_TO_POLLY_LIB}/LLVMPolly.dylib -mem2reg -no-aa
> -targetlibinfo -tbaa -basicaa -preverify -domtree -verify -mem2reg
> -instcombine -simplifycfg -tailcallelim -simplifycfg -reassociate
> -domtree -loops -loop-simplify -lcssa -loop-rotate -instcombine
> -scalar-evolution -loop-simplify -lcssa -indvars -polly-prepare
> -postdomtree -domfrontier -regions -polly-region-simplify
> -scalar-evolution -loop-simplify -lcssa -indvars -postdomtree
> -domfrontier -regions  -loop-simplify -indvars  -enable-iv-rewrite
> not_so_simple_loop.s
> strange ...
Very strange. I have seen such problems previously and they were often
related to enabling rtti (runtime type info) or exceptions in Polly, but 
no clang or the other way around. I am not sure if this is the case her.

Another possibility is that clang does not use the RegionInfo stuff and
it gets dead code eliminated.

Can you run the following commands on the clang binary:

ldd /path/to/clang
objdump -xC /path/to/clang | grep RegionInfo

Can you also run them on the opt tool?

Are you building with cmake or autoconf? Do you use 
--enable-shared/BUILD_SHARED_LIBS. In case you do/don't it would be 
interesting to try to switch. Especially using shared libraries may help 
as it may block some dead code elimination.


More information about the llvm-dev mailing list