forked from OSchip/llvm-project
No need to check for non-existing std::map elements
It seems we added guards to check for non-existing std::map elements to make sure they are default constructed before first accessed. Besides, the code being wrong because of checking Context.NonAffineAccesses[BasePointer].size() instead of Context.cound(BasePointer), such a check is also not necessary as std::map takes care of this already. From the std::map documentation: "If k does not match the key of any element in the container, the function inserts a new element with that key and returns a reference to its mapped value. Notice that this always increases the container size by one, even if no mapped value is assigned to the element (the element is constructed using its default constructor)." llvm-svn: 217506
This commit is contained in:
parent
cfb28f77a4
commit
31f3da3d2a
|
@ -449,13 +449,9 @@ bool ScopDetection::isValidMemoryAccess(Instruction &Inst,
|
|||
// Collect all non affine memory accesses, and check whether they are linear
|
||||
// at the end of scop detection. That way we can delinearize all the memory
|
||||
// accesses to the same array in a unique step.
|
||||
if (Context.NonAffineAccesses[BasePointer].size() == 0)
|
||||
Context.NonAffineAccesses[BasePointer] = AFs();
|
||||
Context.NonAffineAccesses[BasePointer].push_back({&Inst, AF});
|
||||
} else if (const SCEVAddRecExpr *AF =
|
||||
dyn_cast<SCEVAddRecExpr>(AccessFunction)) {
|
||||
if (Context.AffineAccesses[BasePointer].size() == 0)
|
||||
Context.AffineAccesses[BasePointer] = AFs();
|
||||
Context.AffineAccesses[BasePointer].push_back({&Inst, AF});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue