[llvm-bugs] [Bug 49105] New: wrong code with "-sroa -gvn -licm -loop-rotate -loop-vectorize"
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Feb 8 22:50:12 PST 2021
https://bugs.llvm.org/show_bug.cgi?id=49105
Bug ID: 49105
Summary: wrong code with "-sroa -gvn -licm -loop-rotate
-loop-vectorize"
Product: new-bugs
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: enhancement
Priority: P
Component: new bugs
Assignee: unassignedbugs at nondot.org
Reporter: suochenyao at 163.com
CC: htmldeveloper at gmail.com, llvm-bugs at lists.llvm.org
Created attachment 24503
--> https://bugs.llvm.org/attachment.cgi?id=24503&action=edit
IR that is passed to opt
*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
int printf(const char *, ...);
int a;
void b() {
a = 0;
for (; a <= 9; a++)
;
}
void main() {
int c, d = 0;
b();
printf("%d\n", a);
}
*******************************************************************************
clang version:
$ clang -v
clang version 10.0.0 (/home/suocy/src/llvm-dev/llvm/tools/clang
65acf43270ea2894dffa0d0b292b92402f80c8cb) (/home/suocy/src/llvm-dev/llvm
2c4ca6832fa6b306ee6a7010bfb80a3f2596f824)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/suocy/bin/llvm-dev/bin
Found candidate GCC installation:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-redhat-linux/4.8.5
Selected GCC installation:
/opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Selected multilib: .;@m64
*******************************************************************************
Command Lines:
$ clang -O3 -mllvm -disable-llvm-optzns -c -emit-llvm a.c -o a.bc
a.c:8:1: warning: return type of 'main' is not 'int' [-Wmain-return-type]
void main() {
^
a.c:8:1: note: change return type to 'int'
void main() {
^~~~
int
1 warning generated.
$ opt -sroa -gvn -licm -loop-rotate -loop-vectorize a.bc -o a.opt.bc
$ clang a.opt.bc -o a1.o
$ clang a.bc -o a2.o
$ ./a1.o
15
$ ./a2.o
10
--
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/20210209/68a2d803/attachment.html>
More information about the llvm-bugs
mailing list