[LLVMdev] Vectorization of loops with conditional dereferencing
Nadav Rotem
nrotem at apple.com
Thu Nov 14 08:38:30 PST 2013
>
> I'm not. :(
>
I think that this is probably the most important feature for the vectorizer right now. Other features require adding complexity to the vectorizer while this feature is relatively simple.
> What kind of pragmas would work for this loop? Something telling that it's safe to speculatively read from m[] at any position? In this reduction case it might be enough. But if this would be an induction store like:
>
> for () {
> if (a[i] > 0)
> x[i] = ... + m[i];
>
Sure. Vectorization of stores is done by loading the current value from memory, blending the new value and saving it back to memory.
> then, the store would be a more complicated way to write to memory and you'd need the read-pragma to not affect such cases.
There is no need for read pragma or even a special attribute. The ‘vectorize’ pragma tells the vectorizer that it is safe to access the predicated memory (read or write).
More information about the llvm-dev
mailing list