@@ -177,7 +177,7 @@ template <> struct DenseMapInfo<GVN::Expression> {
177
177
// / implicitly associated with a rematerialization point which is the
178
178
// / location of the instruction from which it was formed.
179
179
struct llvm ::gvn::AvailableValue {
180
- enum ValType {
180
+ enum class ValType {
181
181
SimpleVal, // A simple offsetted value that is accessed.
182
182
LoadVal, // A value produced by a load.
183
183
MemIntrin, // A memory intrinsic which is loaded from.
@@ -187,76 +187,78 @@ struct llvm::gvn::AvailableValue {
187
187
// can be replace by a value select.
188
188
};
189
189
190
- // / V - The value that is live out of the block.
191
- PointerIntPair<Value *, 3 , ValType> Val;
190
+ // / Val - The value that is live out of the block.
191
+ Value *Val;
192
+ // / Kind of the live-out value.
193
+ ValType Kind;
192
194
193
195
// / Offset - The byte offset in Val that is interesting for the load query.
194
196
unsigned Offset = 0 ;
195
197
196
198
static AvailableValue get (Value *V, unsigned Offset = 0 ) {
197
199
AvailableValue Res;
198
- Res.Val . setPointer (V) ;
199
- Res.Val . setInt ( SimpleVal) ;
200
+ Res.Val = V ;
201
+ Res.Kind = ValType:: SimpleVal;
200
202
Res.Offset = Offset;
201
203
return Res;
202
204
}
203
205
204
206
static AvailableValue getMI (MemIntrinsic *MI, unsigned Offset = 0 ) {
205
207
AvailableValue Res;
206
- Res.Val . setPointer (MI) ;
207
- Res.Val . setInt ( MemIntrin) ;
208
+ Res.Val = MI ;
209
+ Res.Kind = ValType:: MemIntrin;
208
210
Res.Offset = Offset;
209
211
return Res;
210
212
}
211
213
212
214
static AvailableValue getLoad (LoadInst *Load, unsigned Offset = 0 ) {
213
215
AvailableValue Res;
214
- Res.Val . setPointer ( Load) ;
215
- Res.Val . setInt ( LoadVal) ;
216
+ Res.Val = Load;
217
+ Res.Kind = ValType:: LoadVal;
216
218
Res.Offset = Offset;
217
219
return Res;
218
220
}
219
221
220
222
static AvailableValue getUndef () {
221
223
AvailableValue Res;
222
- Res.Val . setPointer ( nullptr ) ;
223
- Res.Val . setInt ( UndefVal) ;
224
+ Res.Val = nullptr ;
225
+ Res.Kind = ValType:: UndefVal;
224
226
Res.Offset = 0 ;
225
227
return Res;
226
228
}
227
229
228
230
static AvailableValue getSelect (SelectInst *Sel) {
229
231
AvailableValue Res;
230
- Res.Val . setPointer ( Sel) ;
231
- Res.Val . setInt ( SelectVal) ;
232
+ Res.Val = Sel;
233
+ Res.Kind = ValType:: SelectVal;
232
234
Res.Offset = 0 ;
233
235
return Res;
234
236
}
235
237
236
- bool isSimpleValue () const { return Val. getInt () == SimpleVal; }
237
- bool isCoercedLoadValue () const { return Val. getInt () == LoadVal; }
238
- bool isMemIntrinValue () const { return Val. getInt () == MemIntrin; }
239
- bool isUndefValue () const { return Val. getInt () == UndefVal; }
240
- bool isSelectValue () const { return Val. getInt () == SelectVal; }
238
+ bool isSimpleValue () const { return Kind == ValType:: SimpleVal; }
239
+ bool isCoercedLoadValue () const { return Kind == ValType:: LoadVal; }
240
+ bool isMemIntrinValue () const { return Kind == ValType:: MemIntrin; }
241
+ bool isUndefValue () const { return Kind == ValType:: UndefVal; }
242
+ bool isSelectValue () const { return Kind == ValType:: SelectVal; }
241
243
242
244
Value *getSimpleValue () const {
243
245
assert (isSimpleValue () && " Wrong accessor" );
244
- return Val. getPointer () ;
246
+ return Val;
245
247
}
246
248
247
249
LoadInst *getCoercedLoadValue () const {
248
250
assert (isCoercedLoadValue () && " Wrong accessor" );
249
- return cast<LoadInst>(Val. getPointer () );
251
+ return cast<LoadInst>(Val);
250
252
}
251
253
252
254
MemIntrinsic *getMemIntrinValue () const {
253
255
assert (isMemIntrinValue () && " Wrong accessor" );
254
- return cast<MemIntrinsic>(Val. getPointer () );
256
+ return cast<MemIntrinsic>(Val);
255
257
}
256
258
257
259
SelectInst *getSelectValue () const {
258
260
assert (isSelectValue () && " Wrong accessor" );
259
- return cast<SelectInst>(Val. getPointer () );
261
+ return cast<SelectInst>(Val);
260
262
}
261
263
262
264
// / Emit code at the specified insertion point to adjust the value defined
0 commit comments