Skip to content

[InstCombine] Combine x < ~x into x < 0 #57532

@Kmeakin

Description

@Kmeakin

This is listed in Synthesizing an instruction selection rule library from semantic specifications as an example of patterns that were synthesized by an SMT solver but were missing from both GCC and LLVM.

32-bit example (godbolt, alive):

bool src(int32_t x) { return x < ~x; }

bool tgt(int32_t x) { return x < 0; }

Metadata

Metadata

Assignees

Labels

good first issuehttps://github.com/llvm/llvm-project/contributellvm:instcombineCovers the InstCombine, InstSimplify and AggressiveInstCombine passesmissed-optimization

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions