mirror of
https://github.com/RPCSX/llvm.git
synced 2025-05-13 19:06:05 +00:00
[DemandedBits] Reduce number of duplicated DenseMap lookups.
No functionality change intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@276278 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
1a324fd49a
commit
ffecbde8b3
@ -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()));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user