15#define DEBUG_TYPE "vplan"
19 for (
unsigned I = 1, E = R->getNumIncomingValues();
I != E; ++
I) {
20 VPValue *Inc = R->getIncomingValue(
I);
22 "different types inferred for different incoming values");
23 CachedTypes[Inc] = ResTy;
29 switch (
R->getOpcode()) {
30 case Instruction::Select: {
34 "different types inferred for different operands");
35 CachedTypes[OtherV] = ResTy;
39 case Instruction::ICmp:
44 "different types inferred for different operands");
45 CachedTypes[OtherV] = ResTy;
51 "unexpected scalar type inferred for operand");
62 dbgs() <<
"LV: Found unhandled opcode for: ";
63 R->getVPSingleValue()->dump();
69 unsigned Opcode =
R->getOpcode();
71 case Instruction::ICmp:
72 case Instruction::FCmp:
74 case Instruction::UDiv:
75 case Instruction::SDiv:
76 case Instruction::SRem:
77 case Instruction::URem:
78 case Instruction::Add:
79 case Instruction::FAdd:
80 case Instruction::Sub:
81 case Instruction::FSub:
82 case Instruction::Mul:
83 case Instruction::FMul:
84 case Instruction::FDiv:
85 case Instruction::FRem:
86 case Instruction::Shl:
87 case Instruction::LShr:
88 case Instruction::AShr:
89 case Instruction::And:
91 case Instruction::Xor: {
94 "types for both operands must match for binary op");
95 CachedTypes[
R->getOperand(1)] = ResTy;
98 case Instruction::FNeg:
99 case Instruction::Freeze:
107 dbgs() <<
"LV: Found unhandled opcode for: ";
108 R->getVPSingleValue()->dump();
114 auto &CI = *cast<CallInst>(
R->getUnderlyingInstr());
119 assert((isa<VPWidenLoadRecipe>(R) || isa<VPWidenLoadEVLRecipe>(R)) &&
120 "Store recipes should not define any values");
121 return cast<LoadInst>(&
R->getIngredient())->getType();
128 "different types inferred for different operands");
129 CachedTypes[OtherV] = ResTy;
134 switch (
R->getUnderlyingInstr()->getOpcode()) {
135 case Instruction::Call: {
136 unsigned CallIdx =
R->getNumOperands() - (
R->isPredicated() ? 2 : 1);
137 return cast<Function>(
R->getOperand(CallIdx)->getLiveInIRValue())
140 case Instruction::UDiv:
141 case Instruction::SDiv:
142 case Instruction::SRem:
143 case Instruction::URem:
144 case Instruction::Add:
145 case Instruction::FAdd:
146 case Instruction::Sub:
147 case Instruction::FSub:
148 case Instruction::Mul:
149 case Instruction::FMul:
150 case Instruction::FDiv:
151 case Instruction::FRem:
152 case Instruction::Shl:
153 case Instruction::LShr:
154 case Instruction::AShr:
155 case Instruction::And:
156 case Instruction::Or:
157 case Instruction::Xor: {
160 "inferred types for operands of binary op don't match");
161 CachedTypes[
R->getOperand(1)] = ResTy;
164 case Instruction::Select: {
167 "inferred types for operands of select op don't match");
168 CachedTypes[
R->getOperand(2)] = ResTy;
171 case Instruction::ICmp:
172 case Instruction::FCmp:
174 case Instruction::Alloca:
175 case Instruction::BitCast:
176 case Instruction::Trunc:
177 case Instruction::SExt:
178 case Instruction::ZExt:
179 case Instruction::FPExt:
180 case Instruction::FPTrunc:
181 case Instruction::ExtractValue:
182 case Instruction::SIToFP:
183 case Instruction::UIToFP:
184 case Instruction::FPToSI:
185 case Instruction::FPToUI:
186 case Instruction::PtrToInt:
187 case Instruction::IntToPtr:
188 return R->getUnderlyingInstr()->getType();
189 case Instruction::Freeze:
190 case Instruction::FNeg:
191 case Instruction::GetElementPtr:
193 case Instruction::Load:
194 return cast<LoadInst>(
R->getUnderlyingInstr())->getType();
195 case Instruction::Store:
205 dbgs() <<
"LV: Found unhandled opcode for: ";
206 R->getVPSingleValue()->dump();
212 if (
Type *CachedTy = CachedTypes.lookup(V))
216 if (
auto *IRValue = V->getLiveInIRValue())
217 return IRValue->getType();
220 return CanonicalIVTy;
234 .Case<VPWidenIntOrFpInductionRecipe, VPDerivedIVRecipe>(
235 [](
const auto *R) {
return R->getScalarType(); })
242 [
this](
const auto *R) {
return inferScalarTypeForRecipe(R); })
245 return V->getUnderlyingValue()->getType();
247 .Case<VPWidenCastRecipe>(
249 .Case<VPScalarCastRecipe>(
252 return R->getSCEV()->getType();
255 assert(ResultTy &&
"could not infer type for the given VPValue");
256 CachedTypes[V] = ResultTy;
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This file implements the TypeSwitch template, which mimics a switch() statement whose cases are type ...
This file contains the declarations of the Vectorization Plan base classes:
static IntegerType * get(LLVMContext &C, unsigned NumBits)
This static method is the primary way of constructing an IntegerType.
This class implements a switch-like dispatch statement for a value of 'T' using dyn_cast functionalit...
TypeSwitch< T, ResultT > & Case(CallableT &&caseFn)
Add a case on the given type.
The instances of the Type class are immutable: once they are created, they are never changed.
static Type * getVoidTy(LLVMContext &C)
A recipe for vectorizing a phi-node as a sequence of mask-based select instructions.
Canonical scalar induction phi of the vector loop.
A recipe for generating the phi node for the current index of elements, adjusted in accordance with E...
Recipe to expand a SCEV expression.
This is a concrete Recipe that models a single VPlan-level instruction.
@ FirstOrderRecurrenceSplice
VPInterleaveRecipe is a recipe for transforming an interleave group of load or stores into one wide l...
VPPredInstPHIRecipe is a recipe for generating the phi nodes needed when control converges back from ...
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
A recipe for handling reduction phis.
VPReplicateRecipe replicates a given instruction producing multiple scalar copies of the original sca...
VPScalarCastRecipe is a recipe to create scalar cast instructions.
A recipe for handling phi nodes of integer and floating-point inductions, producing their scalar valu...
Type * inferScalarType(const VPValue *V)
Infer the type of V. Returns the scalar type of V.
A recipe for widening Call instructions.
VPWidenCastRecipe is a recipe to create vector cast instructions.
A recipe for handling GEP instructions.
A common base class for widening memory operations.
A recipe for handling phis that are widened in the vector loop.
VPWidenRecipe is a recipe for producing a copy of vector type its ingredient.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
This is an optimization pass for GlobalISel generic memory operations.
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
A recipe for handling first-order recurrence phis.
A recipe for widening select instructions.