@@ -52,57 +52,54 @@ class PtrUseVisitorBase {
5252 // / analysis and whether the visit completed or aborted early.
5353 class PtrInfo {
5454 public:
55- PtrInfo () : AbortedInfo(nullptr , false ), EscapedInfo(nullptr , false ) {}
56-
5755 // / Reset the pointer info, clearing all state.
5856 void reset () {
59- AbortedInfo.setPointer (nullptr );
60- AbortedInfo.setInt (false );
61- EscapedInfo.setPointer (nullptr );
62- EscapedInfo.setInt (false );
57+ AbortedInfo = nullptr ;
58+ EscapedInfo = nullptr ;
6359 }
6460
6561 // / Did we abort the visit early?
66- bool isAborted () const { return AbortedInfo. getInt () ; }
62+ bool isAborted () const { return AbortedInfo != nullptr ; }
6763
6864 // / Is the pointer escaped at some point?
69- bool isEscaped () const { return EscapedInfo. getInt () ; }
65+ bool isEscaped () const { return EscapedInfo != nullptr ; }
7066
7167 // / Get the instruction causing the visit to abort.
7268 // / \returns a pointer to the instruction causing the abort if one is
7369 // / available; otherwise returns null.
74- Instruction *getAbortingInst () const { return AbortedInfo. getPointer () ; }
70+ Instruction *getAbortingInst () const { return AbortedInfo; }
7571
7672 // / Get the instruction causing the pointer to escape.
7773 // / \returns a pointer to the instruction which escapes the pointer if one
7874 // / is available; otherwise returns null.
79- Instruction *getEscapingInst () const { return EscapedInfo. getPointer () ; }
75+ Instruction *getEscapingInst () const { return EscapedInfo; }
8076
8177 // / Mark the visit as aborted. Intended for use in a void return.
8278 // / \param I The instruction which caused the visit to abort, if available.
83- void setAborted (Instruction *I = nullptr ) {
84- AbortedInfo. setInt ( true );
85- AbortedInfo. setPointer (I) ;
79+ void setAborted (Instruction *I) {
80+ assert (I && " Expected a valid pointer in setAborted " );
81+ AbortedInfo = I ;
8682 }
8783
8884 // / Mark the pointer as escaped. Intended for use in a void return.
8985 // / \param I The instruction which escapes the pointer, if available.
90- void setEscaped (Instruction *I = nullptr ) {
91- EscapedInfo. setInt ( true );
92- EscapedInfo. setPointer (I) ;
86+ void setEscaped (Instruction *I) {
87+ assert (I && " Expected a valid pointer in setEscaped " );
88+ EscapedInfo = I ;
9389 }
9490
9591 // / Mark the pointer as escaped, and the visit as aborted. Intended
9692 // / for use in a void return.
9793 // / \param I The instruction which both escapes the pointer and aborts the
9894 // / visit, if available.
99- void setEscapedAndAborted (Instruction *I = nullptr ) {
95+ void setEscapedAndAborted (Instruction *I) {
10096 setEscaped (I);
10197 setAborted (I);
10298 }
10399
104100 private:
105- PointerIntPair<Instruction *, 1 , bool > AbortedInfo, EscapedInfo;
101+ Instruction *AbortedInfo = nullptr ;
102+ Instruction *EscapedInfo = nullptr ;
106103 };
107104
108105protected:
0 commit comments