If the instruction has no users, it is also not only used by debug info
and should not be deleted.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67194
91177308-0d34-0410-b5e6-
96231b3b80d8
CleanupGEP(GEPI);
else if (Instruction *I = dyn_cast<Instruction>(U)) {
SmallVector<DbgInfoIntrinsic *, 2> DbgInUses;
- if (OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) {
+ if (!I->use_empty() && OnlyUsedByDbgInfoIntrinsics(I, &DbgInUses)) {
// Safe to remove debug info uses.
while (!DbgInUses.empty()) {
DbgInfoIntrinsic *DI = DbgInUses.back(); DbgInUses.pop_back();
if (DbgInUses)
DbgInUses->clear();
- if (I->use_empty())
- return false;
-
for (Value::use_iterator UI = I->use_begin(), UE = I->use_end(); UI != UE;
++UI) {
if (DbgInfoIntrinsic *DI = dyn_cast<DbgInfoIntrinsic>(*UI)) {