@@ -295,9 +295,9 @@ A code snippet for such a walk looks like this:
295
295
.. code-block :: c++
296
296
297
297
MemoryDef *Def; // find who's optimized or defining for this MemoryDef
298
- for (auto& U : Def->uses()) {
299
- MemoryAccess *MA = cast<MemoryAccess>(Use .getUser());
300
- if (auto *DefUser = cast_of_null <MemoryDef>MA )
298
+ for (auto & U : Def->uses()) {
299
+ MemoryAccess *MA = cast<MemoryAccess>(U .getUser());
300
+ if (auto *DefUser = dyn_cast <MemoryDef>(MA) )
301
301
if (DefUser->isOptimized() && DefUser->getOptimized() == Def) {
302
302
// User who is optimized to Def
303
303
} else {
@@ -312,19 +312,18 @@ the store.
312
312
.. code-block :: c++
313
313
314
314
checkUses(MemoryAccess *Def) { // Def can be a MemoryDef or a MemoryPhi.
315
- for (auto& U : Def->uses()) {
316
- MemoryAccess *MA = cast<MemoryAccess>(Use .getUser());
317
- if (auto *MU = cast_of_null <MemoryUse>MA ) {
315
+ for (auto & U : Def->uses()) {
316
+ MemoryAccess *MA = cast<MemoryAccess>(U .getUser());
317
+ if (auto *MU = dyn_cast <MemoryUse>(MA) ) {
318
318
// Process MemoryUse as needed.
319
- }
320
- else {
319
+ } else {
321
320
// Process MemoryDef or MemoryPhi as needed.
322
321
323
322
// As a user can come up twice, as an optimized access and defining
324
323
// access, keep a visited list.
325
324
326
325
// Check transitive uses as needed
327
- checkUses (MA); // use a worklist for an iterative algorithm
326
+ checkUses(MA); // use a worklist for an iterative algorithm
328
327
}
329
328
}
330
329
}
0 commit comments