Skip to content

Commit b66f7c1

Browse files
PawelJurekigcbot
authored andcommitted
ValueTracking: do not return nullptr in case non-const index is detected
In case a part of structure that didn't contain image was modified with dynamic index, we could lose opportunity to track the value. When we return nullptr, the BTI is set to 0 and we end up with wrong access. It is better to continue searching, as no high-level API is allowed to access images dynamically currently.
1 parent 6db650d commit b66f7c1

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

IGC/Compiler/Optimizer/ValueTracker.cpp

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -286,16 +286,7 @@ Value* ValueTracker::findAllocaValue(Value* V, const uint depth)
286286
if (auto* GEP = dyn_cast<GetElementPtrInst>(U))
287287
{
288288
if (!GEP->hasAllConstantIndices()) {
289-
// We can continue, only if the non-const index was after our depth.
290-
unsigned firstNonConstIndex = 0;
291-
for (unsigned i = 0; i < GEP->getNumIndices(); ++i) {
292-
if (!isa<ConstantInt>(GEP->getOperand(i + 1))) {
293-
firstNonConstIndex = i;
294-
break;
295-
}
296-
}
297-
if (firstNonConstIndex < depth)
298-
return nullptr;
289+
continue;
299290
}
300291

301292
unsigned numIndices = GEP->getNumIndices();

0 commit comments

Comments
 (0)