diff options
| author | 2017-01-24 08:32:59 +0000 | |
|---|---|---|
| committer | 2017-01-24 08:32:59 +0000 | |
| commit | 53d771aafdbe5b919f264f53cba3788e2c4cffd2 (patch) | |
| tree | 7eca39498be0ff1e3a6daf583cd9ca5886bb2636 /gnu/llvm/lib/Analysis/DemandedBits.cpp | |
| parent | In preparation of compiling our kernels with -ffreestanding, explicitly map (diff) | |
| download | wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.tar.xz wireguard-openbsd-53d771aafdbe5b919f264f53cba3788e2c4cffd2.zip | |
Import LLVM 4.0.0 rc1 including clang and lld to help the current
development effort on OpenBSD/arm64.
Diffstat (limited to 'gnu/llvm/lib/Analysis/DemandedBits.cpp')
| -rw-r--r-- | gnu/llvm/lib/Analysis/DemandedBits.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gnu/llvm/lib/Analysis/DemandedBits.cpp b/gnu/llvm/lib/Analysis/DemandedBits.cpp index a3f8b7fda08..688c1db534c 100644 --- a/gnu/llvm/lib/Analysis/DemandedBits.cpp +++ b/gnu/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())); } @@ -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); |
