Skip to content

[InstCombine] Infinite loop/hang #83354

Closed
@patrick-rivos

Description

@patrick-rivos

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

Metadata

Metadata

Assignees

Labels

hangCompiler hang (infinite loop)llvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passes

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions