Skip to content

Commit

Permalink
[LegalizeIntegerTypes] Rename NewLHS/NewRHS arguments to DAGTypeLegal…
Browse files Browse the repository at this point in the history
…izer::PromoteSetCCOperands. NFC

The 'New' only makes sense in the context of these being
output arguments, but they are also used as inputs first.
Drop the 'New' and just call them LHS/RHS.

Factored out of D116421.
  • Loading branch information
topperc committed Dec 30, 2021
1 parent a699b2f commit 7d659c6
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,7 @@ bool DAGTypeLegalizer::PromoteIntegerOperand(SDNode *N, unsigned OpNo) {

/// PromoteSetCCOperands - Promote the operands of a comparison. This code is
/// shared among BR_CC, SELECT_CC, and SETCC handlers.
void DAGTypeLegalizer::PromoteSetCCOperands(SDValue &NewLHS,SDValue &NewRHS,
void DAGTypeLegalizer::PromoteSetCCOperands(SDValue &LHS, SDValue &RHS,
ISD::CondCode CCCode) {
// We have to insert explicit sign or zero extends. Note that we could
// insert sign extends for ALL conditions. For those operations where either
Expand All @@ -1714,38 +1714,38 @@ void DAGTypeLegalizer::PromoteSetCCOperands(SDValue &NewLHS,SDValue &NewRHS,
default: llvm_unreachable("Unknown integer comparison!");
case ISD::SETEQ:
case ISD::SETNE: {
SDValue OpL = GetPromotedInteger(NewLHS);
SDValue OpR = GetPromotedInteger(NewRHS);
SDValue OpL = GetPromotedInteger(LHS);
SDValue OpR = GetPromotedInteger(RHS);

// We would prefer to promote the comparison operand with sign extension.
// If the width of OpL/OpR excluding the duplicated sign bits is no greater
// than the width of NewLHS/NewRH, we can avoid inserting real truncate
// than the width of LHS/RHS, we can avoid inserting real truncate
// instruction, which is redundant eventually.
unsigned OpLEffectiveBits = DAG.ComputeMinSignedBits(OpL);
unsigned OpREffectiveBits = DAG.ComputeMinSignedBits(OpR);
if (OpLEffectiveBits <= NewLHS.getScalarValueSizeInBits() &&
OpREffectiveBits <= NewRHS.getScalarValueSizeInBits()) {
NewLHS = OpL;
NewRHS = OpR;
if (OpLEffectiveBits <= LHS.getScalarValueSizeInBits() &&
OpREffectiveBits <= RHS.getScalarValueSizeInBits()) {
LHS = OpL;
RHS = OpR;
} else {
NewLHS = SExtOrZExtPromotedInteger(NewLHS);
NewRHS = SExtOrZExtPromotedInteger(NewRHS);
LHS = SExtOrZExtPromotedInteger(LHS);
RHS = SExtOrZExtPromotedInteger(RHS);
}
break;
}
case ISD::SETUGE:
case ISD::SETUGT:
case ISD::SETULE:
case ISD::SETULT:
NewLHS = SExtOrZExtPromotedInteger(NewLHS);
NewRHS = SExtOrZExtPromotedInteger(NewRHS);
LHS = SExtOrZExtPromotedInteger(LHS);
RHS = SExtOrZExtPromotedInteger(RHS);
break;
case ISD::SETGE:
case ISD::SETGT:
case ISD::SETLT:
case ISD::SETLE:
NewLHS = SExtPromotedInteger(NewLHS);
NewRHS = SExtPromotedInteger(NewRHS);
LHS = SExtPromotedInteger(LHS);
RHS = SExtPromotedInteger(RHS);
break;
}
}
Expand Down

0 comments on commit 7d659c6

Please sign in to comment.