@@ -178,7 +178,7 @@ template <> struct DenseMapInfo<GVNPass::Expression> {
178178// / implicitly associated with a rematerialization point which is the
179179// / location of the instruction from which it was formed.
180180struct llvm ::gvn::AvailableValue {
181- enum ValType {
181+ enum class ValType {
182182 SimpleVal, // A simple offsetted value that is accessed.
183183 LoadVal, // A value produced by a load.
184184 MemIntrin, // A memory intrinsic which is loaded from.
@@ -188,76 +188,78 @@ struct llvm::gvn::AvailableValue {
188188 // can be replace by a value select.
189189 };
190190
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;
193195
194196 // / Offset - The byte offset in Val that is interesting for the load query.
195197 unsigned Offset = 0 ;
196198
197199 static AvailableValue get (Value *V, unsigned Offset = 0 ) {
198200 AvailableValue Res;
199- Res.Val . setPointer (V) ;
200- Res.Val . setInt ( SimpleVal) ;
201+ Res.Val = V ;
202+ Res.Kind = ValType:: SimpleVal;
201203 Res.Offset = Offset;
202204 return Res;
203205 }
204206
205207 static AvailableValue getMI (MemIntrinsic *MI, unsigned Offset = 0 ) {
206208 AvailableValue Res;
207- Res.Val . setPointer (MI) ;
208- Res.Val . setInt ( MemIntrin) ;
209+ Res.Val = MI ;
210+ Res.Kind = ValType:: MemIntrin;
209211 Res.Offset = Offset;
210212 return Res;
211213 }
212214
213215 static AvailableValue getLoad (LoadInst *Load, unsigned Offset = 0 ) {
214216 AvailableValue Res;
215- Res.Val . setPointer ( Load) ;
216- Res.Val . setInt ( LoadVal) ;
217+ Res.Val = Load;
218+ Res.Kind = ValType:: LoadVal;
217219 Res.Offset = Offset;
218220 return Res;
219221 }
220222
221223 static AvailableValue getUndef () {
222224 AvailableValue Res;
223- Res.Val . setPointer ( nullptr ) ;
224- Res.Val . setInt ( UndefVal) ;
225+ Res.Val = nullptr ;
226+ Res.Kind = ValType:: UndefVal;
225227 Res.Offset = 0 ;
226228 return Res;
227229 }
228230
229231 static AvailableValue getSelect (SelectInst *Sel) {
230232 AvailableValue Res;
231- Res.Val . setPointer ( Sel) ;
232- Res.Val . setInt ( SelectVal) ;
233+ Res.Val = Sel;
234+ Res.Kind = ValType:: SelectVal;
233235 Res.Offset = 0 ;
234236 return Res;
235237 }
236238
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; }
242244
243245 Value *getSimpleValue () const {
244246 assert (isSimpleValue () && " Wrong accessor" );
245- return Val. getPointer () ;
247+ return Val;
246248 }
247249
248250 LoadInst *getCoercedLoadValue () const {
249251 assert (isCoercedLoadValue () && " Wrong accessor" );
250- return cast<LoadInst>(Val. getPointer () );
252+ return cast<LoadInst>(Val);
251253 }
252254
253255 MemIntrinsic *getMemIntrinValue () const {
254256 assert (isMemIntrinValue () && " Wrong accessor" );
255- return cast<MemIntrinsic>(Val. getPointer () );
257+ return cast<MemIntrinsic>(Val);
256258 }
257259
258260 SelectInst *getSelectValue () const {
259261 assert (isSelectValue () && " Wrong accessor" );
260- return cast<SelectInst>(Val. getPointer () );
262+ return cast<SelectInst>(Val);
261263 }
262264
263265 // / Emit code at the specified insertion point to adjust the value defined
0 commit comments