diff options
author | Alexey Samsonov <samsonov@google.com> | 2012-10-09 10:34:52 +0000 |
---|---|---|
committer | Alexey Samsonov <samsonov@google.com> | 2012-10-09 10:34:52 +0000 |
commit | 942895d371c4dfc96105665b5ed8644f05ab8eff (patch) | |
tree | daa1aa485ebbf4aade3e5bdcc9248321e569b23a /lib/Transforms | |
parent | 943c29135e03e55f9a5dab393786171a4a536482 (diff) | |
download | external_llvm-942895d371c4dfc96105665b5ed8644f05ab8eff.zip external_llvm-942895d371c4dfc96105665b5ed8644f05ab8eff.tar.gz external_llvm-942895d371c4dfc96105665b5ed8644f05ab8eff.tar.bz2 |
Fixup for r165490: Use DenseMap instead of std::map. Simplify the loop in CollectFunctionDIs.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@165498 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/IPO/DeadArgumentElimination.cpp | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp index 29053a0..b107669 100644 --- a/lib/Transforms/IPO/DeadArgumentElimination.cpp +++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp @@ -32,6 +32,7 @@ #include "llvm/Support/CallSite.h" #include "llvm/Support/Debug.h" #include "llvm/Support/raw_ostream.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/Statistic.h" #include "llvm/ADT/StringExtras.h" @@ -129,7 +130,7 @@ namespace { // As the code generation for module is finished (and DIBuilder is // finalized) we assume that subprogram descriptors won't be changed, and // they are stored in map for short duration anyway. - typedef std::map<Function*, DISubprogram> FunctionDIMap; + typedef DenseMap<Function*, DISubprogram> FunctionDIMap; FunctionDIMap FunctionDIs; protected: @@ -200,18 +201,20 @@ void DAE::CollectFunctionDIs(Module &M) { for (Module::named_metadata_iterator I = M.named_metadata_begin(), E = M.named_metadata_end(); I != E; ++I) { NamedMDNode &NMD = *I; - for (unsigned i = 0, n = NMD.getNumOperands(); i < n; ++i) { - MDNode *Node = NMD.getOperand(i); - if (DIDescriptor(Node).isCompileUnit()) { - DICompileUnit CU(Node); - const DIArray &SPs = CU.getSubprograms(); - for (unsigned i = 0, n = SPs.getNumElements(); i < n; ++i) { - DISubprogram SP(SPs.getElement(i)); - if (SP.Verify()) { - if (Function *F = SP.getFunction()) - FunctionDIs[F] = SP; - } - } + for (unsigned MDIndex = 0, MDNum = NMD.getNumOperands(); + MDIndex < MDNum; ++MDIndex) { + MDNode *Node = NMD.getOperand(MDIndex); + if (!DIDescriptor(Node).isCompileUnit()) + continue; + DICompileUnit CU(Node); + const DIArray &SPs = CU.getSubprograms(); + for (unsigned SPIndex = 0, SPNum = SPs.getNumElements(); + SPIndex < SPNum; ++SPIndex) { + DISubprogram SP(SPs.getElement(SPIndex)); + if (!SP.Verify()) + continue; + if (Function *F = SP.getFunction()) + FunctionDIs[F] = SP; } } } |