@@ -20,14 +20,13 @@ class BasicBlock;
20
20
21
21
bool User::replaceUsesOfWith (Value *From, Value *To) {
22
22
bool Changed = false ;
23
- if (From == To)
24
- return Changed; // Duh what?
23
+ if (From == To) return Changed; // Duh what?
25
24
26
25
assert ((!isa<Constant>(this ) || isa<GlobalValue>(this )) &&
27
26
" Cannot call User::replaceUsesOfWith on a constant!" );
28
27
29
28
for (unsigned i = 0 , E = getNumOperands (); i != E; ++i)
30
- if (getOperand (i) == From) { // Is This operand is pointing to oldval?
29
+ if (getOperand (i) == From) { // Is This operand is pointing to oldval?
31
30
// The side effects of this setOperand call include linking to
32
31
// "To", adding "this" to the uses list of To, and
33
32
// most importantly, removing "this" from the use list of "From".
@@ -58,7 +57,7 @@ void User::allocHungoffUses(unsigned N, bool IsPhi) {
58
57
size_t size = N * sizeof (Use);
59
58
if (IsPhi)
60
59
size += N * sizeof (BasicBlock *);
61
- Use *Begin = static_cast <Use *>(::operator new (size));
60
+ Use *Begin = static_cast <Use*>(::operator new (size));
62
61
Use *End = Begin + N;
63
62
setOperandList (Begin);
64
63
for (; Begin != End; Begin++)
@@ -146,9 +145,6 @@ void *User::allocateFixedOperandUser(size_t Size, unsigned Us,
146
145
Use *Start = reinterpret_cast <Use *>(Storage + DescBytesToAllocate);
147
146
Use *End = Start + Us;
148
147
User *Obj = reinterpret_cast <User *>(End);
149
- Obj->NumUserOperands = Us;
150
- Obj->HasHungOffUses = false ;
151
- Obj->HasDescriptor = DescBytes != 0 ;
152
148
for (; Start != End; Start++)
153
149
new (Start) Use (Obj);
154
150
@@ -175,9 +171,6 @@ void *User::operator new(size_t Size, HungOffOperandsAllocMarker) {
175
171
void *Storage = ::operator new (Size + sizeof (Use *));
176
172
Use **HungOffOperandList = static_cast <Use **>(Storage);
177
173
User *Obj = reinterpret_cast <User *>(HungOffOperandList + 1 );
178
- Obj->NumUserOperands = 0 ;
179
- Obj->HasHungOffUses = true ;
180
- Obj->HasDescriptor = false ;
181
174
*HungOffOperandList = nullptr ;
182
175
return Obj;
183
176
}
@@ -214,12 +207,7 @@ LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE void User::operator delete(void *Usr) {
214
207
// Repress memory sanitization, due to use-after-destroy by operator
215
208
// delete. Bug report 24578 identifies this issue.
216
209
LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE void
217
- User::operator delete (void *Usr, const HungOffOperandsAllocMarker Marker) {
218
- // Note: If a subclass manipulates the information which is required to
219
- // calculate the Usr memory pointer, e.g. NumUserOperands, the operator
220
- // delete of that subclass has to restore the changed information to the
221
- // original value, since the dtor of that class is not called if the ctor
222
- // fails.
210
+ User::operator delete (void *Usr, HungOffOperandsAllocMarker Marker) {
223
211
Use **HungOffOperandList = static_cast <Use **>(Usr) - 1 ;
224
212
// drop the hung off uses.
225
213
Use::zap (*HungOffOperandList, *HungOffOperandList + Marker.NumOps ,
@@ -230,11 +218,7 @@ User::operator delete(void *Usr, const HungOffOperandsAllocMarker Marker) {
230
218
// Repress memory sanitization, due to use-after-destroy by operator
231
219
// delete. Bug report 24578 identifies this issue.
232
220
LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE void
233
- User::operator delete (void *Usr, const IntrusiveOperandsAllocMarker Marker) {
234
- // Note: If a subclass manipulates the information which is required to
235
- // calculate the Usr memory pointer, e.g. NumUserOperands, the operator delete
236
- // of that subclass has to restore the changed information to the original
237
- // value, since the dtor of that class is not called if the ctor fails.
221
+ User::operator delete (void *Usr, IntrusiveOperandsAllocMarker Marker) {
238
222
Use *Storage = static_cast <Use *>(Usr) - Marker.NumOps ;
239
223
Use::zap (Storage, Storage + Marker.NumOps , /* Delete */ false );
240
224
::operator delete (Storage);
@@ -244,11 +228,7 @@ User::operator delete(void *Usr, const IntrusiveOperandsAllocMarker Marker) {
244
228
// delete. Bug report 24578 identifies this issue.
245
229
LLVM_NO_SANITIZE_MEMORY_ATTRIBUTE void
246
230
User::operator delete (void *Usr,
247
- const IntrusiveOperandsAndDescriptorAllocMarker Marker) {
248
- // Note: If a subclass manipulates the information which is required to
249
- // calculate the Usr memory pointer, e.g. NumUserOperands, the operator delete
250
- // of that subclass has to restore the changed information to the original
251
- // value, since the dtor of that class is not called if the ctor fails.
231
+ IntrusiveOperandsAndDescriptorAllocMarker Marker) {
252
232
Use *UseBegin = static_cast <Use *>(Usr) - Marker.NumOps ;
253
233
Use::zap (UseBegin, UseBegin + Marker.NumOps , /* Delete */ false );
254
234
0 commit comments