From 9ad082eb5a948ffd5d8fc959967d184c3433aca0 Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sat, 30 Jul 2022 13:59:47 +0100 Subject: [PATCH] [DAG] Pull out repeated getOperand() calls for shuffle ops. NFC. --- llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp index e4abafb..0d50665 100644 --- a/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp @@ -3189,6 +3189,8 @@ bool TargetLowering::SimplifyDemandedVectorElts( break; } case ISD::VECTOR_SHUFFLE: { + SDValue LHS = Op.getOperand(0); + SDValue RHS = Op.getOperand(1); ArrayRef ShuffleMask = cast(Op)->getMask(); // Collect demanded elements from shuffle operands.. @@ -3208,11 +3210,11 @@ bool TargetLowering::SimplifyDemandedVectorElts( // See if we can simplify either shuffle operand. APInt UndefLHS, ZeroLHS; APInt UndefRHS, ZeroRHS; - if (SimplifyDemandedVectorElts(Op.getOperand(0), DemandedLHS, UndefLHS, - ZeroLHS, TLO, Depth + 1)) + if (SimplifyDemandedVectorElts(LHS, DemandedLHS, UndefLHS, ZeroLHS, TLO, + Depth + 1)) return true; - if (SimplifyDemandedVectorElts(Op.getOperand(1), DemandedRHS, UndefRHS, - ZeroRHS, TLO, Depth + 1)) + if (SimplifyDemandedVectorElts(RHS, DemandedRHS, UndefRHS, ZeroRHS, TLO, + Depth + 1)) return true; // Simplify mask using undef elements from LHS/RHS. @@ -3236,8 +3238,7 @@ bool TargetLowering::SimplifyDemandedVectorElts( // to Identity which can cause premature removal of the shuffle mask. if (Updated && !IdentityLHS && !IdentityRHS && !TLO.LegalOps) { SDValue LegalShuffle = - buildLegalVectorShuffle(VT, DL, Op.getOperand(0), Op.getOperand(1), - NewMask, TLO.DAG); + buildLegalVectorShuffle(VT, DL, LHS, RHS, NewMask, TLO.DAG); if (LegalShuffle) return TLO.CombineTo(Op, LegalShuffle); } -- 2.7.4