enum MaskedICmpType

Description

Classify (icmp eq (A & B), C) and (icmp ne (A & B), C) as matching patterns that can be simplified. One of A and B is considered the mask. The other is the value. This is described as the "AMask" or "BMask" part of the enum. If the enum contains only "Mask", then both A and B can be considered masks. If A is the mask, then it was proven that (A & C) == C. This is trivial if C == A or C == 0. If both A and C are constants, this proof is also easy. For the following explanations, we assume that A is the mask. "AllOnes" declares that the comparison is true only if (A & B) == A or all bits of A are set in B. Example: (icmp eq (A & 3), 3) -> AMask_AllOnes "AllZeros" declares that the comparison is true only if (A & B) == 0 or all bits of A are cleared in B. Example: (icmp eq (A & 3), 0) -> Mask_AllZeroes "Mixed" declares that (A & B) == C and C might or might not contain any number of one bits and zero bits. Example: (icmp eq (A & 3), 1) -> AMask_Mixed "Not" means that in above descriptions "==" should be replaced by "!=". Example: (icmp ne (A & 3), 3) -> AMask_NotAllOnes If the mask A contains a single bit, then the following is equivalent: (icmp eq (A & B), A) equals (icmp ne (A & B), 0) (icmp ne (A & B), A) equals (icmp eq (A & B), 0)

Declared at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:141

Enumerators

NameValueComment
AMask_AllOnes1
AMask_NotAllOnes2
BMask_AllOnes4
BMask_NotAllOnes8
Mask_AllZeros16
Mask_NotAllZeros32
AMask_Mixed64
AMask_NotMixed128
BMask_Mixed256
BMask_NotMixed512