Skip to content

Commit 8094f8e

Browse files
scottp101Zuul
authored andcommitted
Fix issue in constant coalescing. Pointer value will sometimes
be in 'baseIdxV' when 'bufIdxV' is not available. Change-Id: Ibcbfac73c0d3bfbf6f3ac4b13e14cddcf38f740a
1 parent e55b653 commit 8094f8e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

IGC/Compiler/CISACodeGen/ConstantCoalescing.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,8 +852,10 @@ void ConstantCoalescing::MergeScatterLoad(Instruction* load,
852852

853853
Value* ConstantCoalescing::FormChunkAddress(BufChunk* chunk)
854854
{
855-
assert(chunk->bufIdxV);
856-
WIAnalysis::WIDependancy uniformness = wiAns->whichDepend(chunk->bufIdxV);
855+
assert((chunk->bufIdxV || chunk->baseIdxV) && "at least one!");
856+
WIAnalysis::WIDependancy uniformness = chunk->bufIdxV ?
857+
wiAns->whichDepend(chunk->bufIdxV) :
858+
wiAns->whichDepend(chunk->baseIdxV);
857859
Value* eac = chunk->baseIdxV;
858860
if (chunk->chunkStart && chunk->baseIdxV)
859861
{
@@ -866,8 +868,10 @@ Value* ConstantCoalescing::FormChunkAddress(BufChunk* chunk)
866868
uniformness = WIAnalysis::RANDOM;
867869
}
868870
}
869-
Value* bufsrc = chunk->bufIdxV;
870-
if (chunk->bufIdxV->getType()->isPointerTy())
871+
Value* bufsrc = chunk->bufIdxV ?
872+
chunk->bufIdxV :
873+
ConstantInt::get(chunk->baseIdxV->getType(), 0);
874+
if (bufsrc->getType()->isPointerTy())
871875
{
872876
Type* ptrIntTy = dataLayout->getIntPtrType(cast<PointerType>(chunk->bufIdxV->getType()));
873877
bufsrc = irBuilder->CreatePtrToInt(chunk->bufIdxV, ptrIntTy);

0 commit comments

Comments
 (0)