diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:17:04 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:17:04 +0000 |
commit | b915e9e0fc85ba6f398b3fab0db6a81a8913af94 (patch) | |
tree | 98b8f811c7aff2547cab8642daf372d6c59502fb /lib/Analysis/DemandedBits.cpp | |
parent | 6421cca32f69ac849537a3cff78c352195e99f1b (diff) | |
download | src-test2-b915e9e0fc85ba6f398b3fab0db6a81a8913af94.tar.gz src-test2-b915e9e0fc85ba6f398b3fab0db6a81a8913af94.zip |
Notes
Diffstat (limited to 'lib/Analysis/DemandedBits.cpp')
-rw-r--r-- | lib/Analysis/DemandedBits.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/lib/Analysis/DemandedBits.cpp b/lib/Analysis/DemandedBits.cpp index a3f8b7fda08a..688c1db534c1 100644 --- a/lib/Analysis/DemandedBits.cpp +++ b/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())); } @@ -387,10 +386,10 @@ FunctionPass *llvm::createDemandedBitsWrapperPass() { return new DemandedBitsWrapperPass(); } -char DemandedBitsAnalysis::PassID; +AnalysisKey DemandedBitsAnalysis::Key; DemandedBits DemandedBitsAnalysis::run(Function &F, - AnalysisManager<Function> &AM) { + FunctionAnalysisManager &AM) { auto &AC = AM.getResult<AssumptionAnalysis>(F); auto &DT = AM.getResult<DominatorTreeAnalysis>(F); return DemandedBits(F, AC, DT); |