[llvm-bugs] [Bug 48334] New: wrong code with "-mem2reg -instcombine -simplifycfg -inline"
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Nov 30 01:03:47 PST 2020
https://bugs.llvm.org/show_bug.cgi?id=48334
Bug ID: 48334
Summary: wrong code with "-mem2reg -instcombine -simplifycfg
-inline"
Product: new-bugs
Version: trunk
Hardware: PC
OS: Windows NT
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 24221
--> https://bugs.llvm.org/attachment.cgi?id=24221&action=edit
bc file
*******************************************************************************
OS and Platform:
CentOS Linux release 7.8.2003 (Core), x86_64 GNU/Linux
*******************************************************************************
Program:
$ cat a.c
int printf(const char *, ...);
int a=0;
int(b)(c) { return 7 >> c; }
void d() { a = b(133); }
int main() {
d();
printf("%d\n", a);
}
*******************************************************************************
clang version:
$ clang --version
clang version 12.0.0 (/home/suocy/src/llvm-dev/llvm-project/llvm/tools/clang
f15b7869e5afbd6c24ef440b0b62593e80fbd24f)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/suocy/bin/llvm-dev/bin
*******************************************************************************
Command Lines:
$ clang -c -emit-llvm -O3 -mllvm -disable-llvm-optzns a.c -o a.bc
$ opt a.bc -o a.opt1.bc
$ clang a.opt1.bc -o a1.o
$ opt -mem2reg -instcombine -simplifycfg -inline a.bc -o a.opt2.bc
$ clang a.opt2.bc -o a2.o
$ ./a1.o
0
$ ./a2.o
4195600
--
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/20201130/ea60183c/attachment.html>
More information about the llvm-bugs
mailing list