Skip to content

Commit

Permalink
Revert "Treat geps with indices zero as bitcast in value tracker (#2…
Browse files Browse the repository at this point in the history
…1232)"

This reverts commit 2c12e65.
  • Loading branch information
smilczek authored and igcbot committed Jan 9, 2025
1 parent f2312b8 commit bfc8455
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 208 deletions.
18 changes: 2 additions & 16 deletions IGC/Compiler/Optimizer/ValueTracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,6 @@ Value* ValueTracker::handleConstExpr(ConstantExpr* CE)
}
}

// returns true if all GEP indices are 0 and constant.
static bool GEP_is_bitcast(const GetElementPtrInst* GEP)
{
// if all indices are zero, the gep is essentially a bitcast.
return GEP->hasAllZeroIndices();
}

// This function represents the second step of the overall algorithm. It goes
// down through the tree and looks for the value stored in alloca. In most cases
// it returns the final value (image, sampler or constant). For more complex cases,
Expand All @@ -298,11 +291,6 @@ Value* ValueTracker::findAllocaValue(Value* V, const uint depth)
continue;
}

if (GEP_is_bitcast(GEP)) {
if (auto leaf = findAllocaValue(GEP, depth); isValidLeaf(leaf))
return leaf;
}

unsigned numIndices = GEP->getNumIndices();
if (numIndices > depth + 1)
continue;
Expand Down Expand Up @@ -467,10 +455,8 @@ Value* ValueTracker::trackValue(Value* I)
}
else if (auto* I = dyn_cast<GetElementPtrInst>(baseValue))
{
if (!GEP_is_bitcast(I)) {
for (unsigned int i = I->getNumIndices(); i > 1; --i)
gepIndices.push_back(cast<ConstantInt>(I->getOperand(i)));
}
for (unsigned int i = I->getNumIndices(); i > 1; --i)
gepIndices.push_back(cast<ConstantInt>(I->getOperand(i)));

baseValue = I->getOperand(0);
}
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit bfc8455

Please sign in to comment.