summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
index 8a8f82af82c..9f03e03892e 100644
--- a/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
+++ b/llvm/lib/Transforms/Scalar/InferAddressSpaces.cpp
@@ -583,14 +583,12 @@ Optional<unsigned> InferAddressSpaces::updateAddressSpace(
// of all its pointer operands.
unsigned NewAS = UninitializedAddressSpace;
for (Value *PtrOperand : getPointerOperands(V)) {
- unsigned OperandAS;
- if (InferredAddrSpace.count(PtrOperand))
- OperandAS = InferredAddrSpace.lookup(PtrOperand);
- else
- OperandAS = PtrOperand->getType()->getPointerAddressSpace();
- NewAS = joinAddressSpaces(NewAS, OperandAS);
+ auto I = InferredAddrSpace.find(PtrOperand);
+ unsigned OperandAS = I != InferredAddrSpace.end() ?
+ I->second : PtrOperand->getType()->getPointerAddressSpace();
// join(flat, *) = flat. So we can break if NewAS is already flat.
+ NewAS = joinAddressSpaces(NewAS, OperandAS);
if (NewAS == FlatAddrSpace)
break;
}
OpenPOWER on IntegriCloud