[LLVMdev] LLVM Loop Vectorizer

Andrew Trick atrick at apple.com
Fri Oct 5 14:27:11 PDT 2012

On Oct 5, 2012, at 1:47 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> I don't really understand where you want to draw the line. Should the inliner get target-specific input?

Inlining always does a canonical transformation. It can take whatever target data is available at it's level for heuristics, but that doesn't make it a target lowering pass.

Similarly, full unrolling is a canonical transformation that may use target-specific heuristics. Contrast that with partial unrolling or vectorization, which are anti-canonical transformations. 

> InstCombine?

I think there is too much temptation currently to use the canonical InstCombine pass to facilitate instruction selection. It should only facilitate downstream IR analysis and simplification.

I see no problem conceptually running an anti-canonical InstCombine as part of codegen that makes use of target hooks. I think this would make ISEL problems easier to deal with, and will eventually be necessary anyway to clean up after other target lowering passes. Obviously not a perfect solution, but better than doing everything in one CodeGenPrepare pass.

> How about Polly? I think that the answer to all of these questions is probably, at some level, yes.

There is always the option of splitting a loop optimization problem into an early, canonical run to aid analysis, followed by a late target lowering run to optimize codegen. That's only a problem when the canonicalization can badly pessimize the code in a way that loses information or is hard to recover from.


More information about the llvm-dev mailing list