[llvm] r264904 - [LoopVectorize] Don't vectorize loops when everything will be scalarized

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 15:09:17 PDT 2016


Hi Dimitry -

This is an x86 backend bug, so the optimized (vectorized) IR should be all
that is needed to reproduce the bug. I've filed this as PR27973:
https://llvm.org/bugs/show_bug.cgi?id=27973





On Wed, Jun 1, 2016 at 3:09 PM, Dimitry Andric <dimitry at andric.com> wrote:

> On 30 Mar 2016, at 21:37, Hal Finkel via llvm-commits <
> llvm-commits at lists.llvm.org> wrote:
> >
> > Author: hfinkel
> > Date: Wed Mar 30 14:37:08 2016
> > New Revision: 264904
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=264904&view=rev
> > Log:
> > [LoopVectorize] Don't vectorize loops when everything will be scalarized
> ...
> > This is not a problem specific to PPC/QPX, however. The problem comes up
> under
> > SSE on x86 too, and as such, this change fixes PR26837 too. I've added
> Sanjay's
> > reduced test case from PR26837 to this commit.
>
> Hi Hal,
>
> I am investigating an assertion failure reported by Guido Falsi, which
> occurs during compilation of a certain FreeBSD port with clang 3.8.0 (the
> version we currently have in FreeBSD 11).  This assertion is:
>
> Assertion failed: (Subtarget.hasSSE2() && "Requires at least SSE2!"),
> function ReplaceNodeResults, file lib/Target/X86/X86ISelLowering.cpp, line
> 21400.
>
> Interestingly, this assertion was fixed in later versions of llvm trunk,
> and bisecting shows that it appears to be "fixed" by your r264904.
> However, maybe this just exposed some problem in the vectorizer, and this
> problem is now masked by your commit?
>
> The reduced test case is just this:
>
> int a, b;
> void fn1() {
>   char *c;
>   unsigned char *d;
>   int e = b;
>   for (int y = 0; y < a; y = 2)
>     for (int i; i < e; i++) {
>       *c++ = (d[e] + 1) / 2;
>       d++;
>     }
> }
>
> and the minimal command line to make it assert (with clang 3.8.0 or trunk
> before r264904) is:
>
> clang -cc1 -triple i386 -emit-obj -target-cpu pentium3 -O1
> -vectorize-loops testcase.cpp
>
> The important parts are: the pentium3 target, and -vectorize-loops.  If
> you use pentium2 or pentium4, it does *not* assert.
>
> Do you know of a way to 'undo' your commit, in the sense that you somehow
> *force* llvm to vectorize the loop?  I suspect there is some sort of
> incorrect usage of SSE2, specifically with the Pentium3 target, which blows
> something up...
>
> -Dimitry
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160601/3c364e72/attachment.html>


More information about the llvm-commits mailing list