Skip to content

Commit bd40e93

Browse files
committed
[TSAR, Memory, ArrayAccess] Store constant subscript as a DIAffineSubscript.
1 parent 366c2bf commit bd40e93

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

lib/Analysis/Memory/DIArrayAccess.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -627,16 +627,23 @@ void IRToArrayInfoFunctor::operator()(Instruction &I, MemoryLocation &&Loc,
627627
Coef = SE.getZero(S->getType());
628628
ConstTerm = S;
629629
}
630-
if (!L || !isa<SCEVConstant>(Coef) || !isa<SCEVConstant>(ConstTerm))
631-
continue;
632-
auto MonomLoopID = L->getLoopID();
633-
if (!MonomLoopID)
630+
if (!isa<SCEVConstant>(ConstTerm))
634631
continue;
632+
ObjectID MonomLoopID = nullptr;
633+
if (L) {
634+
if (!isa<SCEVConstant>(Coef))
635+
continue;
636+
MonomLoopID = L->getLoopID();
637+
if (!MonomLoopID)
638+
continue;
639+
}
635640
auto ConstTermValue = cast<SCEVConstant>(ConstTerm)->getAPInt();
636641
auto *DimAccess =
637642
Access->make<DIAffineSubscript>(DimIdx, APSInt(ConstTermValue, false));
638-
auto CoefValue = cast<SCEVConstant>(Coef)->getAPInt();
639-
DimAccess->emplaceMonom(MonomLoopID, APSInt(CoefValue, false));
643+
if (L) {
644+
auto CoefValue = cast<SCEVConstant>(Coef)->getAPInt();
645+
DimAccess->emplaceMonom(MonomLoopID, APSInt(CoefValue, false));
646+
}
640647
LLVM_DEBUG(dbgs() << "[DI ARRAY ACCESS]: dimension " << DimIdx
641648
<< " subscript " << DimAccess->getConstant();
642649
for (unsigned I = 0, EI = DimAccess->getNumberOfMonoms(); I < EI;

0 commit comments

Comments
 (0)