@@ -41,59 +41,7 @@ const SCEV *getSCEVExprForVPValue(VPValue *V, ScalarEvolution &SE);
4141
4242// / Returns true if \p VPV is a single scalar, either because it produces the
4343// / same value for all lanes or only has its first lane used.
44- inline bool isSingleScalar (const VPValue *VPV) {
45- auto PreservesUniformity = [](unsigned Opcode) -> bool {
46- if (Instruction::isBinaryOp (Opcode) || Instruction::isCast (Opcode))
47- return true ;
48- switch (Opcode) {
49- case Instruction::GetElementPtr:
50- case Instruction::ICmp:
51- case Instruction::FCmp:
52- case Instruction::Select:
53- case VPInstruction::Not:
54- case VPInstruction::Broadcast:
55- case VPInstruction::PtrAdd:
56- return true ;
57- default :
58- return false ;
59- }
60- };
61-
62- // A live-in must be uniform across the scope of VPlan.
63- if (VPV->isLiveIn ())
64- return true ;
65-
66- if (auto *Rep = dyn_cast<VPReplicateRecipe>(VPV)) {
67- const VPRegionBlock *RegionOfR = Rep->getRegion ();
68- // Don't consider recipes in replicate regions as uniform yet; their first
69- // lane cannot be accessed when executing the replicate region for other
70- // lanes.
71- if (RegionOfR && RegionOfR->isReplicator ())
72- return false ;
73- return Rep->isSingleScalar () || (PreservesUniformity (Rep->getOpcode ()) &&
74- all_of (Rep->operands (), isSingleScalar));
75- }
76- if (isa<VPWidenGEPRecipe, VPDerivedIVRecipe, VPBlendRecipe,
77- VPWidenSelectRecipe>(VPV))
78- return all_of (VPV->getDefiningRecipe ()->operands (), isSingleScalar);
79- if (auto *WidenR = dyn_cast<VPWidenRecipe>(VPV)) {
80- return PreservesUniformity (WidenR->getOpcode ()) &&
81- all_of (WidenR->operands (), isSingleScalar);
82- }
83- if (auto *VPI = dyn_cast<VPInstruction>(VPV))
84- return VPI->isSingleScalar () || VPI->isVectorToScalar () ||
85- (PreservesUniformity (VPI->getOpcode ()) &&
86- all_of (VPI->operands (), isSingleScalar));
87- if (isa<VPPartialReductionRecipe>(VPV))
88- return false ;
89- if (isa<VPReductionRecipe>(VPV))
90- return true ;
91- if (auto *Expr = dyn_cast<VPExpressionRecipe>(VPV))
92- return Expr->isSingleScalar ();
93-
94- // VPExpandSCEVRecipes must be placed in the entry and are alway uniform.
95- return isa<VPExpandSCEVRecipe>(VPV);
96- }
44+ bool isSingleScalar (const VPValue *VPV);
9745
9846// / Return true if \p V is a header mask in \p Plan.
9947bool isHeaderMask (const VPValue *V, const VPlan &Plan);
0 commit comments