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