Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[InstCombine] Infinite loop/hang #83354

Closed
patrick-rivos opened this issue Feb 28, 2024 · 1 comment · Fixed by #84036
Closed

[InstCombine] Infinite loop/hang #83354

patrick-rivos opened this issue Feb 28, 2024 · 1 comment · Fixed by #84036
Assignees
Labels
hang Compiler hang (infinite loop) llvm:instcombine

Comments

@patrick-rivos
Copy link
Contributor

Reduced C program:

int b;
void a(int d, int e);
void c() {
    a(((((!0) >= b) & b) == b) & b, b);
}

Godbolt: https://godbolt.org/z/GYdsMYWMq

Commands:

> timeout 60 clang -O1 red.c
> echo $?
124

Reduced LLVM IR:

define void @c(ptr %b) {
entry:
  %0 = load i32, ptr %b, align 4
  %cmp = icmp slt i32 %0, 2
  %1 = and i32 %0, 1
  %and = select i1 %cmp, i32 %1, i32 0
  %cmp1 = icmp eq i32 %and, %0
  %and3 = select i1 %cmp1, i32 %1, i32 0
  call void null(i32 %and3, i32 noundef %0)
  ret void
}

Godbolt: https://godbolt.org/z/7bnhd9saK

Commands:

> timeout 60 /scratch/tc-testing/tc-feb-22-llvm/build/build-llvm-linux/bin/opt -passes=instcombine reduced.ll -disable-output
> echo $?
124

Found via fuzzer

@patrick-rivos
Copy link
Contributor Author

patrick-rivos commented Feb 28, 2024

Whoops, should've searched before submitting. Likely related to/duplicate of #83127

@EugeneZelenko EugeneZelenko added llvm:instcombine hang Compiler hang (infinite loop) and removed new issue labels Feb 28, 2024
@dtcxzyw dtcxzyw self-assigned this Feb 29, 2024
@dtcxzyw dtcxzyw linked a pull request Mar 5, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hang Compiler hang (infinite loop) llvm:instcombine
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants