-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Description
| Bugzilla Link | 11042 |
| Version | trunk |
| OS | All |
| Reporter | LLVM Bugzilla Contributor |
Extended Description
At around Line 257 and Line 835, DAE preserves debug locations after removing the dead arguments, by copying the debug location from the old call to the new call. Should we do the same thing for other metadata (e.g. customized metadata) as well? Would it break anything?
Btw, this issue appears in LLVM 2.9 and some earlier versions as well.
Proposed patch:
Index: lib/Transforms/IPO/DeadArgumentElimination.cpp
--- lib/Transforms/IPO/DeadArgumentElimination.cpp (revision 140827)
+++ lib/Transforms/IPO/DeadArgumentElimination.cpp (working copy)
@@ -254,7 +254,14 @@
if (cast(Call)->isTailCall())
cast(New)->setTailCall();
}
- New->setDebugLoc(Call->getDebugLoc());
-
// by Jingyue
-
// Copy all metadata
-
if (Call->hasMetadata()) {
-
SmallVector<std::pair<unsigned, MDNode*>, 4> TheMDs; -
Call->getAllMetadata(TheMDs); -
for (unsigned i = 0, e = TheMDs.size(); i != e; ++i) -
New->setMetadata(TheMDs[i].first, TheMDs[i].second); -
}
Args.clear();
@@ -832,7 +839,14 @@
if (cast(Call)->isTailCall())
cast(New)->setTailCall();
}
- New->setDebugLoc(Call->getDebugLoc());
-
// by Jingyue
-
// Copy all metadata
-
if (Call->hasMetadata()) {
-
SmallVector<std::pair<unsigned, MDNode*>, 4> TheMDs; -
Call->getAllMetadata(TheMDs); -
for (unsigned i = 0, e = TheMDs.size(); i != e; ++i) -
New->setMetadata(TheMDs[i].first, TheMDs[i].second); -
}
Args.clear();