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:215
Enumerators
Name | Value | Comment |
---|---|---|
AMask_AllOnes | 1 | |
AMask_NotAllOnes | 2 | |
BMask_AllOnes | 4 | |
BMask_NotAllOnes | 8 | |
Mask_AllZeros | 16 | |
Mask_NotAllZeros | 32 | |
AMask_Mixed | 64 | |
AMask_NotMixed | 128 | |
BMask_Mixed | 256 | |
BMask_NotMixed | 512 |