[llvm] 12ef0d3 - [X86] combinePredicateReduction - pull out repeated DAG.getContext() calls. NFC.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Sat Feb 4 10:31:41 PST 2023
Author: Simon Pilgrim
Date: 2023-02-04T18:31:26Z
New Revision: 12ef0d31e0c815e74efa3f9ab57594cc0b22dd3c
URL: https://github.com/llvm/llvm-project/commit/12ef0d31e0c815e74efa3f9ab57594cc0b22dd3c
DIFF: https://github.com/llvm/llvm-project/commit/12ef0d31e0c815e74efa3f9ab57594cc0b22dd3c.diff
LOG: [X86] combinePredicateReduction - pull out repeated DAG.getContext() calls. NFC.
Added:
Modified:
llvm/lib/Target/X86/X86ISelLowering.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp
index 47e6bd70ab05..fffcea65a571 100644
--- a/llvm/lib/Target/X86/X86ISelLowering.cpp
+++ b/llvm/lib/Target/X86/X86ISelLowering.cpp
@@ -44288,6 +44288,7 @@ static SDValue combinePredicateReduction(SDNode *Extract, SelectionDAG &DAG,
unsigned NumElts = MatchVT.getVectorNumElements();
unsigned MaxElts = Subtarget.hasInt256() ? 32 : 16;
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
+ LLVMContext &Ctx = *DAG.getContext();
if (ExtractVT == MVT::i1) {
// Special case for (pre-legalization) vXi1 reductions.
@@ -44295,7 +44296,7 @@ static SDValue combinePredicateReduction(SDNode *Extract, SelectionDAG &DAG,
return SDValue();
if (TLI.isTypeLegal(MatchVT)) {
// If this is a legal AVX512 predicate type then we can just bitcast.
- EVT MovmskVT = EVT::getIntegerVT(*DAG.getContext(), NumElts);
+ EVT MovmskVT = EVT::getIntegerVT(Ctx, NumElts);
Movmsk = DAG.getBitcast(MovmskVT, Match);
} else {
// For all_of(setcc(x,y,eq)) - use PMOVMSKB(PCMPEQB()).
@@ -44308,8 +44309,8 @@ static SDValue combinePredicateReduction(SDNode *Extract, SelectionDAG &DAG,
EVT VecSVT = VecVT.getScalarType();
if (VecSVT != MVT::i8 && (VecSVT.getSizeInBits() % 8) == 0) {
NumElts *= VecSVT.getSizeInBits() / 8;
- EVT CmpVT = EVT::getVectorVT(*DAG.getContext(), MVT::i8, NumElts);
- MatchVT = EVT::getVectorVT(*DAG.getContext(), MVT::i1, NumElts);
+ EVT CmpVT = EVT::getVectorVT(Ctx, MVT::i8, NumElts);
+ MatchVT = EVT::getVectorVT(Ctx, MVT::i1, NumElts);
Match = DAG.getSetCC(
DL, MatchVT, DAG.getBitcast(CmpVT, Match.getOperand(0)),
DAG.getBitcast(CmpVT, Match.getOperand(1)), CC);
@@ -44324,7 +44325,7 @@ static SDValue combinePredicateReduction(SDNode *Extract, SelectionDAG &DAG,
Match = DAG.getNode(BinOp, DL, Lo.getValueType(), Lo, Hi);
NumElts /= 2;
}
- EVT MovmskVT = EVT::getIntegerVT(*DAG.getContext(), NumElts);
+ EVT MovmskVT = EVT::getIntegerVT(Ctx, NumElts);
Movmsk = combineBitcastvxi1(DAG, MovmskVT, Match, DL, Subtarget);
}
if (!Movmsk)
@@ -44392,8 +44393,7 @@ static SDValue combinePredicateReduction(SDNode *Extract, SelectionDAG &DAG,
// The setcc produces an i8 of 0/1, so extend that to the result width and
// negate to get the final 0/-1 mask value.
- EVT SetccVT =
- TLI.getSetCCResultType(DAG.getDataLayout(), *DAG.getContext(), CmpVT);
+ EVT SetccVT = TLI.getSetCCResultType(DAG.getDataLayout(), Ctx, CmpVT);
SDValue Setcc = DAG.getSetCC(DL, SetccVT, Movmsk, CmpC, CondCode);
SDValue Zext = DAG.getZExtOrTrunc(Setcc, DL, ExtractVT);
SDValue Zero = DAG.getConstant(0, DL, ExtractVT);
More information about the llvm-commits
mailing list