@@ -219,21 +219,23 @@ struct VPTransformState {
219219 struct DataState {
220220 // Each value from the original loop, when vectorized, is represented by a
221221 // vector value in the map.
222- DenseMap<VPValue *, Value *> VPV2Vector;
222+ DenseMap<const VPValue *, Value *> VPV2Vector;
223223
224- DenseMap<VPValue *, SmallVector<Value *, 4 >> VPV2Scalars;
224+ DenseMap<const VPValue *, SmallVector<Value *, 4 >> VPV2Scalars;
225225 } Data;
226226
227227 // / Get the generated vector Value for a given VPValue \p Def if \p IsScalar
228228 // / is false, otherwise return the generated scalar. \See set.
229- Value *get (VPValue *Def, bool IsScalar = false );
229+ Value *get (const VPValue *Def, bool IsScalar = false );
230230
231231 // / Get the generated Value for a given VPValue and given Part and Lane.
232- Value *get (VPValue *Def, const VPLane &Lane);
232+ Value *get (const VPValue *Def, const VPLane &Lane);
233233
234- bool hasVectorValue (VPValue *Def) { return Data.VPV2Vector .contains (Def); }
234+ bool hasVectorValue (const VPValue *Def) {
235+ return Data.VPV2Vector .contains (Def);
236+ }
235237
236- bool hasScalarValue (VPValue *Def, VPLane Lane) {
238+ bool hasScalarValue (const VPValue *Def, VPLane Lane) {
237239 auto I = Data.VPV2Scalars .find (Def);
238240 if (I == Data.VPV2Scalars .end ())
239241 return false ;
@@ -243,7 +245,7 @@ struct VPTransformState {
243245
244246 // / Set the generated vector Value for a given VPValue, if \p
245247 // / IsScalar is false. If \p IsScalar is true, set the scalar in lane 0.
246- void set (VPValue *Def, Value *V, bool IsScalar = false ) {
248+ void set (const VPValue *Def, Value *V, bool IsScalar = false ) {
247249 if (IsScalar) {
248250 set (Def, V, VPLane (0 ));
249251 return ;
@@ -254,13 +256,13 @@ struct VPTransformState {
254256 }
255257
256258 // / Reset an existing vector value for \p Def and a given \p Part.
257- void reset (VPValue *Def, Value *V) {
259+ void reset (const VPValue *Def, Value *V) {
258260 assert (Data.VPV2Vector .contains (Def) && " need to overwrite existing value" );
259261 Data.VPV2Vector [Def] = V;
260262 }
261263
262264 // / Set the generated scalar \p V for \p Def and the given \p Lane.
263- void set (VPValue *Def, Value *V, const VPLane &Lane) {
265+ void set (const VPValue *Def, Value *V, const VPLane &Lane) {
264266 auto &Scalars = Data.VPV2Scalars [Def];
265267 unsigned CacheIdx = Lane.mapToCacheIndex (VF);
266268 if (Scalars.size () <= CacheIdx)
@@ -270,7 +272,7 @@ struct VPTransformState {
270272 }
271273
272274 // / Reset an existing scalar value for \p Def and a given \p Lane.
273- void reset (VPValue *Def, Value *V, const VPLane &Lane) {
275+ void reset (const VPValue *Def, Value *V, const VPLane &Lane) {
274276 auto Iter = Data.VPV2Scalars .find (Def);
275277 assert (Iter != Data.VPV2Scalars .end () &&
276278 " need to overwrite existing value" );
@@ -299,7 +301,7 @@ struct VPTransformState {
299301
300302 // / Construct the vectorized value of a scalarized value \p V one lane at a
301303 // / time.
302- void packScalarIntoVectorizedValue (VPValue *Def, const VPLane &Lane);
304+ void packScalarIntoVectorizedValue (const VPValue *Def, const VPLane &Lane);
303305
304306 // / Hold state information used when constructing the CFG of the output IR,
305307 // / traversing the VPBasicBlocks and generating corresponding IR BasicBlocks.
0 commit comments