|
7 | 7 | //===----------------------------------------------------------------------===// |
8 | 8 |
|
9 | 9 | #include "VPlanUtils.h" |
| 10 | +#include "VPlanAnalysis.h" |
10 | 11 | #include "VPlanCFG.h" |
11 | 12 | #include "VPlanDominatorTree.h" |
12 | 13 | #include "VPlanPatternMatch.h" |
@@ -116,6 +117,27 @@ const SCEV *vputils::getSCEVExprForVPValue(const VPValue *V, |
116 | 117 | return CreateSCEV({LHSVal, RHSVal}, [&](ArrayRef<const SCEV *> Ops) { |
117 | 118 | return SE.getMinusSCEV(Ops[0], Ops[1], SCEV::FlagAnyWrap, 0); |
118 | 119 | }); |
| 120 | + if (match(V, m_Trunc(m_VPValue(LHSVal)))) { |
| 121 | + const VPlan *Plan = V->getDefiningRecipe()->getParent()->getPlan(); |
| 122 | + Type *DestTy = VPTypeAnalysis(*Plan).inferScalarType(V); |
| 123 | + return CreateSCEV({LHSVal}, [&](ArrayRef<const SCEV *> Ops) { |
| 124 | + return SE.getTruncateExpr(Ops[0], DestTy); |
| 125 | + }); |
| 126 | + } |
| 127 | + if (match(V, m_ZExt(m_VPValue(LHSVal)))) { |
| 128 | + const VPlan *Plan = V->getDefiningRecipe()->getParent()->getPlan(); |
| 129 | + Type *DestTy = VPTypeAnalysis(*Plan).inferScalarType(V); |
| 130 | + return CreateSCEV({LHSVal}, [&](ArrayRef<const SCEV *> Ops) { |
| 131 | + return SE.getZeroExtendExpr(Ops[0], DestTy); |
| 132 | + }); |
| 133 | + } |
| 134 | + if (match(V, m_SExt(m_VPValue(LHSVal)))) { |
| 135 | + const VPlan *Plan = V->getDefiningRecipe()->getParent()->getPlan(); |
| 136 | + Type *DestTy = VPTypeAnalysis(*Plan).inferScalarType(V); |
| 137 | + return CreateSCEV({LHSVal}, [&](ArrayRef<const SCEV *> Ops) { |
| 138 | + return SE.getSignExtendExpr(Ops[0], DestTy); |
| 139 | + }); |
| 140 | + } |
119 | 141 |
|
120 | 142 | // TODO: Support constructing SCEVs for more recipes as needed. |
121 | 143 | const VPRecipeBase *DefR = V->getDefiningRecipe(); |
|
0 commit comments