Polly - Getting Started

# Building and Installing Polly

You can build Polly with cmake and your preferred geneator (e.g. Ninja, make, Visual Studio, etc.).

### Get the code

    git clone https://github.com/llvm/llvm-project.git

You can also get a shallow clone by running:

    git clone --depth 1 https://github.com/llvm/llvm-project.git

### Build Polly

    mkdir build && cd build
    cmake '-DLLVM_ENABLE_PROJECTS=clang;polly' ../llvm
    cmake --build .

You can also pass arguments to cmake to specify a particular generator (e.g. `-G Ninja`) or the build type (`-DCMAKE_BUILD_TYPE=Release`). If you just want to play around with Polly, it is recommended to do a Release+Assert build by passing `-DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_ASSERTIONS=ON`.

### Test Polly

To test Polly, you can run

    cmake --build . --target check-polly

### Using Polly

Suppose that you want to compile a program hello.c using Polly. To compile it with Polly (in the build folder), you can run:

    bin/clang -O3 -mllvm -polly hello.c

### Troubleshooting

If you run out of memory when building with Ninja, try lowering the concurrency of Ninja (e.g. `ninja -j 2` ). More tips and tricks to building and using LLVM can be found here.

For more information on getting started with Polly and LLVM in general, see LLVM's getting started docs.