mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-15 20:51:35 +00:00
ScopInfo: Introduce getNumberOfArrayAccesses
Use the new function to clarify that we indeed only want to know it at least one array access is associated with an instruction. llvm-svn: 255776
This commit is contained in:
parent
271186bbb6
commit
2ed317383b
@ -992,6 +992,29 @@ public:
|
||||
return *ArrayAccess;
|
||||
}
|
||||
|
||||
/// @brief Get the number of array accesses associated with an instruction.
|
||||
///
|
||||
/// @param Inst The instruction for which to obtain the access count.
|
||||
/// @returns The number of array accesses associated with this instruction.
|
||||
size_t getNumberOfArrayAccessesFor(const Instruction *Inst) const {
|
||||
size_t NumAccesses = 0;
|
||||
auto It = InstructionToAccess.find(Inst);
|
||||
if (It == InstructionToAccess.end())
|
||||
return 0;
|
||||
|
||||
auto *Accesses = It->getSecond();
|
||||
|
||||
if (!Accesses)
|
||||
return 0;
|
||||
|
||||
for (auto Access : *Accesses) {
|
||||
if (Access->isArrayKind())
|
||||
NumAccesses++;
|
||||
}
|
||||
|
||||
return NumAccesses;
|
||||
}
|
||||
|
||||
/// @brief Return the __first__ (scalar) memory access for @p Inst if any.
|
||||
MemoryAccess *lookupAccessFor(const Instruction *Inst) const {
|
||||
auto It = InstructionToAccess.find(Inst);
|
||||
|
@ -2923,7 +2923,7 @@ void Scop::verifyInvariantLoads() {
|
||||
for (LoadInst *LI : RIL) {
|
||||
assert(LI && getRegion().contains(LI));
|
||||
ScopStmt *Stmt = getStmtForBasicBlock(LI->getParent());
|
||||
if (Stmt && Stmt->lookupAccessesFor(LI)) {
|
||||
if (Stmt && Stmt->getNumberOfArrayAccessesFor(LI) > 0) {
|
||||
invalidate(INVARIANTLOAD, LI->getDebugLoc());
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user