Skip to content

LICM sinks/hoist memory accesses to dead stack objects (wrong code at -O1 on x86_64-linux-gnu) #51838

@zhendongsu

Description

@zhendongsu
Bugzilla Link 52496
Version unspecified
OS All
CC @fhahn,@MaskRay,@preames,@RKSimon,@rnk,@rotateright,@xiangzh1

Extended Description

It appears to be a regression from 12.*.

[758] % clangtk -v clang version 14.0.0 (https://github.com/llvm/llvm-project.git 8ed8d370880b5c4e7bbf52b50791710a9f4f834b) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /local/suz-local/opfuzz/bin Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.5.0 Candidate multilib: .;@m64 Candidate multilib: 32;@m32 Candidate multilib: x32;@mx32 Selected multilib: .;@m64 [759] % [759] % clangtk -O0 -w small.c; ./a.out [760] % [760] % clangtk -O1 -w small.c [761] % ./a.out Aborted [762] % [762] % cat small.c int printf(const char *, ...); int a, *b; int main() { int *c, *d, e; while (a) { int f[1]; while (a) printf(c); c = f; b = (int *)&d; } L: e = 1; if (a) { printf("%d", a); b = &e; (*c)++; } if (a) goto L; if (!e) __builtin_abort(); return 0; } 

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions