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: [email protected]
Reporter: [email protected]
CC: [email protected], [email protected],
[email protected]
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._______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs