Skip to content

Commit

Permalink
[X86] combineSetCCMOVMSK - consistently use CmpBits variable. NFCI.
Browse files Browse the repository at this point in the history
The comparison value should be the same size - I've added an assert to be absolutely certain.
  • Loading branch information
RKSimon committed Jun 20, 2020
1 parent 56a9332 commit 89dcbdf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion llvm/lib/Target/X86/X86ISelLowering.cpp
Expand Up @@ -40518,6 +40518,7 @@ static SDValue combineSetCCMOVMSK(SDValue EFLAGS, X86::CondCode &CC,

SDValue CmpOp = EFLAGS.getOperand(0);
unsigned CmpBits = CmpOp.getValueSizeInBits();
assert(CmpBits == CmpVal.getBitWidth() && "Value size mismatch");

// Peek through any truncate.
if (CmpOp.getOpcode() == ISD::TRUNCATE)
Expand All @@ -40535,7 +40536,7 @@ static SDValue combineSetCCMOVMSK(SDValue EFLAGS, X86::CondCode &CC,
unsigned NumEltBits = VecVT.getScalarSizeInBits();

bool IsAnyOf = CmpOpcode == X86ISD::CMP && CmpVal.isNullValue();
bool IsAllOf = CmpOpcode == X86ISD::SUB && NumElts <= CmpVal.getBitWidth() &&
bool IsAllOf = CmpOpcode == X86ISD::SUB && NumElts <= CmpBits &&
CmpVal.isMask(NumElts);
if (!IsAnyOf && !IsAllOf)
return SDValue();
Expand Down

0 comments on commit 89dcbdf

Please sign in to comment.