Skip to content

clang-20 crashed with optnone attribute at -O1 and above. error in backend: Cannot select: intrinsic %llvm.expect.with.probability. #115411

@iamanonymouscs

Description

@iamanonymouscs

clang-20 crashed with optnone attribute at -O1 and above.

Compiler explorer: https://godbolt.org/z/4dP5xGxnx

$cat mutant.c
int a;
void __attribute__((optnone)) b() {
  int c = __builtin_expect_with_probability(a, 0, 0.8);
}

Also crashed on clang-19.

$clang-19 -O1 mutant.c
fatal error: error in backend: Cannot select: intrinsic %llvm.expect.with.probability
clang: error: clang frontend command failed with exit code 70 (use -v to see invocation)
Ubuntu clang version 19.0.0 (++20240722031324+65825cd5431c-1~exp1~20240722151445.1819)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm-19/bin
clang: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /tmp/mutant-b18d19.c
clang: note: diagnostic msg: /tmp/mutant-b18d19.sh
clang: note: diagnostic msg: 

********************

Metadata

Metadata

Assignees

Labels

clang:codegenIR generation bugs: mangling, exceptions, etc.crashPrefer [crash-on-valid] or [crash-on-invalid]llvm:SelectionDAGSelectionDAGISel as well

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions