[llvm-bugs] [Bug 49939] New: Optimizer does wrong load elimination after a branch
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Apr 12 14:02:48 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=49939
Bug ID: 49939
Summary: Optimizer does wrong load elimination after a branch
Product: clang
Version: 11.0
Hardware: PC
OS: Windows NT
Status: NEW
Severity: enhancement
Priority: P
Component: LLVM Codegen
Assignee: unassignedclangbugs at nondot.org
Reporter: mdzar5 at gmail.com
CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
richard-llvm at metafoo.co.uk
Created attachment 24746
--> https://bugs.llvm.org/attachment.cgi?id=24746&action=edit
Wrong displacement in "mov" instruction highlighted
I don't know what exactly goes wrong here. Looks like LLVM 11.0.0 optimizer
generates wrong IR, if Clang is asked to compile this program:
clang -v -std=c99 -masm=intel -O3 -finline-hint-functions -S bug.c
// bug.c
#include <stdint.h>
typedef unsigned char byte;
typedef uint32_t udword;
typedef struct {
udword x, y, z;
} A;
udword foo(A *s, udword n) {
return s->x + n;
}
void bar(byte *ptr, A *s) {
if (s->y == s->z)
*(ptr + 1) = foo(s, s->z * 3); // -O3 calculates s->y * 3 instead
*ptr = foo(s, s->y);
}
--
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/20210412/e8fd3aa1/attachment.html>
More information about the llvm-bugs
mailing list