Changeset View
Changeset View
Standalone View
Standalone View
llvm/trunk/lib/Analysis/MemorySSAUpdater.cpp
Show First 20 Lines • Show All 260 Lines • ▼ Show 20 Lines | void MemorySSAUpdater::insertDef(MemoryDef *MD, bool RenameUses) { | ||||
// There is a def before us, which means we can replace any store/phi uses | // There is a def before us, which means we can replace any store/phi uses | ||||
// of that thing with us, since we are in the way of whatever was there | // of that thing with us, since we are in the way of whatever was there | ||||
// before. | // before. | ||||
// We now define that def's memorydefs and memoryphis | // We now define that def's memorydefs and memoryphis | ||||
if (DefBeforeSameBlock) { | if (DefBeforeSameBlock) { | ||||
for (auto UI = DefBefore->use_begin(), UE = DefBefore->use_end(); | for (auto UI = DefBefore->use_begin(), UE = DefBefore->use_end(); | ||||
UI != UE;) { | UI != UE;) { | ||||
Use &U = *UI++; | Use &U = *UI++; | ||||
// Leave the uses alone | // Leave the MemoryUses alone. | ||||
if (isa<MemoryUse>(U.getUser())) | // Also make sure we skip ourselves to avoid self references. | ||||
if (isa<MemoryUse>(U.getUser()) || U.getUser() == MD) | |||||
continue; | continue; | ||||
U.set(MD); | U.set(MD); | ||||
} | } | ||||
} | } | ||||
// and that def is now our defining access. | // and that def is now our defining access. | ||||
// We change them in this order otherwise we will appear in the use list | |||||
// above and reset ourselves. | |||||
MD->setDefiningAccess(DefBefore); | MD->setDefiningAccess(DefBefore); | ||||
SmallVector<WeakVH, 8> FixupList(InsertedPHIs.begin(), InsertedPHIs.end()); | SmallVector<WeakVH, 8> FixupList(InsertedPHIs.begin(), InsertedPHIs.end()); | ||||
if (!DefBeforeSameBlock) { | if (!DefBeforeSameBlock) { | ||||
// If there was a local def before us, we must have the same effect it | // If there was a local def before us, we must have the same effect it | ||||
// did. Because every may-def is the same, any phis/etc we would create, it | // did. Because every may-def is the same, any phis/etc we would create, it | ||||
// would also have created. If there was no local def before us, we | // would also have created. If there was no local def before us, we | ||||
// performed a global update, and have to search all successors and make | // performed a global update, and have to search all successors and make | ||||
▲ Show 20 Lines • Show All 877 Lines • Show Last 20 Lines |