Skip to content

Commit edca619

Browse files
Jay-Jiewu-Lusys_zuul
authored andcommitted
Fix IGC crash in case of i1 vector
Change-Id: Ic8d4d0eea0052ce9481228941d63c71ce5ca1ecd
1 parent ad30094 commit edca619

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

IGC/Compiler/CISACodeGen/EmitVISAPass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9672,6 +9672,9 @@ void EmitPass::emitStore3DInner(Value* pllValToStore, Value* pllDstPtr, Value* p
96729672
ResourceDescriptor resource = GetResourceVariable(pllDstPtr);
96739673

96749674
uint sizeInBits = pllValToStore->getType()->getPrimitiveSizeInBits();
9675+
if (0 == sizeInBits && pllValToStore->getType()->isPointerTy()){
9676+
sizeInBits = m_currShader->GetContext()->getRegisterPointerSizeInBits(pllValToStore->getType()->getPointerAddressSpace());
9677+
}
96759678

96769679
assert((sizeInBits == 8 ||
96779680
sizeInBits == 16 ||

IGC/Compiler/ThreadCombining.cpp

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,27 @@ void ThreadCombining::FindRegistersAliveAcrossBarriers(llvm::Function* m_kernel,
316316
}
317317
if (!canMoveInstructionToEntryBlock)
318318
{
319-
m_LiveRegistersPerBarrier[*barrierInst].insert(I); // Insert the instruction as one that has to be stored and then restored
320-
m_aliveAcrossBarrier.insert(I);
319+
if (I->getType()->isIntegerTy() && I->getType()->getIntegerBitWidth() == 1)
320+
{
321+
llvm::IRBuilder<> builder(M.getContext());
322+
llvm::Instruction* aliveInst_clone = I->clone();
323+
aliveInst_clone->insertBefore(I->getNextNode());
324+
builder.SetInsertPoint(aliveInst_clone->getNextNode());
325+
llvm::Value* aliveInst_i8 = builder.CreateZExt(aliveInst_clone, builder.getInt8Ty());
326+
327+
builder.SetInsertPoint((*barrierInst)->getNextNode());
328+
llvm::Value* aliveInst_i1 = builder.CreateICmpEQ(aliveInst_i8, builder.getInt8(1));
329+
330+
I->replaceAllUsesWith(aliveInst_i1);
331+
I->eraseFromParent();
332+
m_LiveRegistersPerBarrier[*barrierInst].insert(dyn_cast<Instruction>(aliveInst_i8));
333+
m_aliveAcrossBarrier.insert(dyn_cast<Instruction>(aliveInst_i8));
334+
}
335+
else
336+
{
337+
m_LiveRegistersPerBarrier[*barrierInst].insert(I); // Insert the instruction as one that has to be stored and then restored
338+
m_aliveAcrossBarrier.insert(I);
339+
}
321340
}
322341
}
323342
}

0 commit comments

Comments
 (0)