Skip to content

Commit bfc8455

Browse files
smilczekigcbot
authored andcommitted
Revert "Treat geps with indices zero as bitcast in value tracker (#21232)"
This reverts commit 2c12e65.
1 parent f2312b8 commit bfc8455

File tree

3 files changed

+2
-208
lines changed

3 files changed

+2
-208
lines changed

IGC/Compiler/Optimizer/ValueTracker.cpp

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -268,13 +268,6 @@ Value* ValueTracker::handleConstExpr(ConstantExpr* CE)
268268
}
269269
}
270270

271-
// returns true if all GEP indices are 0 and constant.
272-
static bool GEP_is_bitcast(const GetElementPtrInst* GEP)
273-
{
274-
// if all indices are zero, the gep is essentially a bitcast.
275-
return GEP->hasAllZeroIndices();
276-
}
277-
278271
// This function represents the second step of the overall algorithm. It goes
279272
// down through the tree and looks for the value stored in alloca. In most cases
280273
// it returns the final value (image, sampler or constant). For more complex cases,
@@ -298,11 +291,6 @@ Value* ValueTracker::findAllocaValue(Value* V, const uint depth)
298291
continue;
299292
}
300293

301-
if (GEP_is_bitcast(GEP)) {
302-
if (auto leaf = findAllocaValue(GEP, depth); isValidLeaf(leaf))
303-
return leaf;
304-
}
305-
306294
unsigned numIndices = GEP->getNumIndices();
307295
if (numIndices > depth + 1)
308296
continue;
@@ -467,10 +455,8 @@ Value* ValueTracker::trackValue(Value* I)
467455
}
468456
else if (auto* I = dyn_cast<GetElementPtrInst>(baseValue))
469457
{
470-
if (!GEP_is_bitcast(I)) {
471-
for (unsigned int i = I->getNumIndices(); i > 1; --i)
472-
gepIndices.push_back(cast<ConstantInt>(I->getOperand(i)));
473-
}
458+
for (unsigned int i = I->getNumIndices(); i > 1; --i)
459+
gepIndices.push_back(cast<ConstantInt>(I->getOperand(i)));
474460

475461
baseValue = I->getOperand(0);
476462
}

IGC/Compiler/tests/OCLBIConverter/value-tracker-find-alloca-val-indirect-direct-bitcast-reverse.ll

Lines changed: 0 additions & 96 deletions
This file was deleted.

IGC/Compiler/tests/OCLBIConverter/value-tracker-find-alloca-val-indirect-direct-bitcast.ll

Lines changed: 0 additions & 96 deletions
This file was deleted.

0 commit comments

Comments
 (0)