@@ -219,21 +219,23 @@ struct VPTransformState {
219
219
struct DataState {
220
220
// Each value from the original loop, when vectorized, is represented by a
221
221
// vector value in the map.
222
- DenseMap<VPValue *, Value *> VPV2Vector;
222
+ DenseMap<const VPValue *, Value *> VPV2Vector;
223
223
224
- DenseMap<VPValue *, SmallVector<Value *, 4 >> VPV2Scalars;
224
+ DenseMap<const VPValue *, SmallVector<Value *, 4 >> VPV2Scalars;
225
225
} Data;
226
226
227
227
// / Get the generated vector Value for a given VPValue \p Def if \p IsScalar
228
228
// / 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 );
230
230
231
231
// / 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);
233
233
234
- bool hasVectorValue (VPValue *Def) { return Data.VPV2Vector .contains (Def); }
234
+ bool hasVectorValue (const VPValue *Def) {
235
+ return Data.VPV2Vector .contains (Def);
236
+ }
235
237
236
- bool hasScalarValue (VPValue *Def, VPLane Lane) {
238
+ bool hasScalarValue (const VPValue *Def, VPLane Lane) {
237
239
auto I = Data.VPV2Scalars .find (Def);
238
240
if (I == Data.VPV2Scalars .end ())
239
241
return false ;
@@ -243,7 +245,7 @@ struct VPTransformState {
243
245
244
246
// / Set the generated vector Value for a given VPValue, if \p
245
247
// / 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 ) {
247
249
if (IsScalar) {
248
250
set (Def, V, VPLane (0 ));
249
251
return ;
@@ -254,13 +256,13 @@ struct VPTransformState {
254
256
}
255
257
256
258
// / 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) {
258
260
assert (Data.VPV2Vector .contains (Def) && " need to overwrite existing value" );
259
261
Data.VPV2Vector [Def] = V;
260
262
}
261
263
262
264
// / 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) {
264
266
auto &Scalars = Data.VPV2Scalars [Def];
265
267
unsigned CacheIdx = Lane.mapToCacheIndex (VF);
266
268
if (Scalars.size () <= CacheIdx)
@@ -270,7 +272,7 @@ struct VPTransformState {
270
272
}
271
273
272
274
// / 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) {
274
276
auto Iter = Data.VPV2Scalars .find (Def);
275
277
assert (Iter != Data.VPV2Scalars .end () &&
276
278
" need to overwrite existing value" );
@@ -299,7 +301,7 @@ struct VPTransformState {
299
301
300
302
// / Construct the vectorized value of a scalarized value \p V one lane at a
301
303
// / time.
302
- void packScalarIntoVectorizedValue (VPValue *Def, const VPLane &Lane);
304
+ void packScalarIntoVectorizedValue (const VPValue *Def, const VPLane &Lane);
303
305
304
306
// / Hold state information used when constructing the CFG of the output IR,
305
307
// / traversing the VPBasicBlocks and generating corresponding IR BasicBlocks.
0 commit comments