[llvm-bugs] [Bug 37649] New: wrong code with "opt -mem2reg -loop-rotate -loop-vectorize"

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 31 22:47:51 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=37649

            Bug ID: 37649
           Summary: wrong code with "opt -mem2reg -loop-rotate
                    -loop-vectorize"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

Created attachment 20379
  --> https://bugs.llvm.org/attachment.cgi?id=20379&action=edit
LLVM IR triggering the wrong code

Tested with trunk revision 333708. 

$ clangpolly -v
clang version 7.0.0 (http://llvm.org/git/clang.git
d8cadd200135a319ef1a7ec2b7cabe210cfb3343) (http://llvm.org/git/llvm.git
238f816f4c47e1de89fb4647c67bdfb5fb3da7dc)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/su/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clangpolly -O3 -mllvm -disable-llvm-optzns -c -emit-llvm -o small.bc small.c
$ optpolly -mem2reg -loop-rotate -loop-vectorize -o small-opt.bc small.bc
$ clangpolly small-opt.bc 
$ ./a.out
Aborted (core dumped)
$ 
$ clangpolly -O0 small.c; ./a.out
$ 


----------------------------


int *a[2], *b, **c = &b;

void f ()
{
  int d, e[1][2];
  for (d = 0; d < 2; d++)
    a[d] = &e[0][1];
  *c = a[1];
  if (!b)
    __builtin_abort ();
}

int main ()
{
  f ();
  return 0;
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180601/65aad949/attachment-0001.html>


More information about the llvm-bugs mailing list