diff options
| author | Benjamin Kramer <benny.kra@googlemail.com> | 2016-07-21 13:37:55 +0000 |
|---|---|---|
| committer | Benjamin Kramer <benny.kra@googlemail.com> | 2016-07-21 13:37:55 +0000 |
| commit | a9e477b286eba7a069e2e2a41cdd2dc6dc96893a (patch) | |
| tree | d2ce7eb2c7e5a12b979f0260c5e0962956329b09 /llvm/lib/Analysis/DemandedBits.cpp | |
| parent | 857754a1cb73b3b71aef847ba8d7e983d4d77e2e (diff) | |
| download | bcm5719-llvm-a9e477b286eba7a069e2e2a41cdd2dc6dc96893a.tar.gz bcm5719-llvm-a9e477b286eba7a069e2e2a41cdd2dc6dc96893a.zip | |
[DemandedBits] Reduce number of duplicated DenseMap lookups.
No functionality change intended.
llvm-svn: 276278
Diffstat (limited to 'llvm/lib/Analysis/DemandedBits.cpp')
| -rw-r--r-- | llvm/lib/Analysis/DemandedBits.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/DemandedBits.cpp b/llvm/lib/Analysis/DemandedBits.cpp index a3f8b7fda08..ee9f2c7ddb5 100644 --- a/llvm/lib/Analysis/DemandedBits.cpp +++ b/llvm/lib/Analysis/DemandedBits.cpp @@ -280,10 +280,8 @@ void DemandedBits::performAnalysis() { // add their operands to the work list (for integer values operands, mark // all bits as live). if (IntegerType *IT = dyn_cast<IntegerType>(I.getType())) { - if (!AliveBits.count(&I)) { - AliveBits[&I] = APInt(IT->getBitWidth(), 0); + if (AliveBits.try_emplace(&I, IT->getBitWidth(), 0).second) Worklist.push_back(&I); - } continue; } @@ -363,8 +361,9 @@ APInt DemandedBits::getDemandedBits(Instruction *I) { performAnalysis(); const DataLayout &DL = I->getParent()->getModule()->getDataLayout(); - if (AliveBits.count(I)) - return AliveBits[I]; + auto Found = AliveBits.find(I); + if (Found != AliveBits.end()) + return Found->second; return APInt::getAllOnesValue(DL.getTypeSizeInBits(I->getType())); } |

