[llvm-bugs] [Bug 37648] New: wrong code with "opt -loop-rotate -mem2reg -loop-vectorize -instcombine"
via llvm-bugs
llvm-bugs at lists.llvm.org
Thu May 31 22:32:08 PDT 2018
https://bugs.llvm.org/show_bug.cgi?id=37648
Bug ID: 37648
Summary: wrong code with "opt -loop-rotate -mem2reg
-loop-vectorize -instcombine"
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 20378
--> https://bugs.llvm.org/attachment.cgi?id=20378&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 -loop-rotate -mem2reg -loop-vectorize -instcombine -o small-opt.bc
small.bc
$ clangpolly small-opt.bc
$ ./a.out
0
$
$ clangpolly -O0 small.c; ./a.out
4
$
---------------------------------
int printf (const char *, ...);
unsigned a = 5;
int main ()
{
int b = 4, c = 0;
for (; c < 29; ++c)
{
int d = -1;
b &= a % d;
}
printf ("%d\n", b);
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/bc101df7/attachment.html>
More information about the llvm-bugs
mailing list