Skip to content

[IndVars][SCEVExpander] Incorrect reuse of disjoint or instructions #79861

@zhendongsu

Description

@zhendongsu

It appears to be a recent regression as it doesn't reproduce with 17.0.1.

Compiler Explorer: https://godbolt.org/z/W5WEb7Eev

[642] % clangtk -v clang version 19.0.0git (https://github.com/llvm/llvm-project.git febb4c42b192ed7c88c17f91cb903a59acf20baf) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /local/suz-local/opfuzz/bin Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11 Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9 Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11 Candidate multilib: .;@m64 Selected multilib: .;@m64 [643] % [643] % clangtk -O2 small.c; ./a.out [644] % [644] % clangtk -O3 small.c [645] % ./a.out Aborted [646] % [646] % cat small.c short a, e; int b[2][5] = {{0, 0, 3, 0, 0}, {0, 0, 0, 0, 0}}, c, d, *f, *g; short h(short j) { return j ? a % j : 0; } void k() { int **l = &f; for (int i = 0; i < 2; i++) g = &c; d = 2; for (; d; d--) { *l = g; **l = 0; for (e = 0; e < 2; e++) { h(d); b[e][d + 2] = 0; if (d) *l = 0; } } } int main() { k(); if (b[0][2] != 3) __builtin_abort(); return 0; } 

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions