XCore target: disable vectorization

Arnold Schwaighofer aschwaighofer at apple.com
Mon Sep 9 11:19:41 PDT 2013


On Sep 9, 2013, at 12:49 PM, Robert Lytton <robert at xmos.com> wrote:

> Hi Arnold,
> 
> In my mind there seems to be two changes needed.

No, with the TTI change you only need an llvm change - no clang change. clang will add the slp/loop-vectorizer but once they execute and ask the target whether they should vectorize (“TTI->getNumberOfRegisters(true)”) these passes immediately give up.

> 
> 1) llvm to check the number of vector registers - as per the direction of this thread.
> Will I also need something similar in BBVectorize? (see below).
> I need to create some tests for the changes - not so straight forward!


You would create a test in "test/Transforms/LoopVectorize/XCore” and “test/Transforms/SLPVectorize/XCore” with “opt -mtriple=XCore- ….” and make sure that you don’t vectorize code you normally would.

> When done, I'll post to llvm-commit and cc folk for comment.
> 
> 2) clang not to set the '-vectorize-loops' & '-vectorize-slp' flags
> Thus the original patch (with corrected function name) would seem reasonable.
> If others agree, I will resubmit the changes.
> 
You would not need this change.

> Robert
> 
> --- a/lib/Transforms/Vectorize/BBVectorize.cpp
> +++ b/lib/Transforms/Vectorize/BBVectorize.cpp
> @@ -397,6 +397,12 @@ namespace {
>       DEBUG(if (TTI) dbgs() << "BBV: using target information\n");
> 
>       bool changed = false;
> +
> +      // If the target claims to have no vector registers don't attempt
> +      // vectorization.
> +      if (TTI && !TTI->getNumberOfRegisters(true))
> +        return false;
> +
>       // Iterate a sufficient number of times to merge types of size 1 bit,





More information about the cfe-commits mailing list