Skip to content

Commit eff75b3

Browse files
jgu222gfxbot
authored andcommitted
Make isLiveOut to work correctly on a local value as well.
Change-Id: I0f4966ee4e3eb49ddb31fd98c7bb55cc3145dd31
1 parent 7c5f179 commit eff75b3

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

IGC/Compiler/CISACodeGen/LiveVars.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,20 @@ bool LiveVars::isLiveAt(Value *VL, Instruction *MI) {
550550
bool LiveVars::isLiveOut(Value *VL, const BasicBlock &MBB) {
551551
LiveVars::LVInfo &VI = getLVInfo(VL);
552552

553+
if (isa<Instruction>(VL) && VI.AliveBlocks.empty())
554+
{
555+
// a local value does not live out of any BB.
556+
// (Originally, this function might be for checking non-local
557+
// value. Adding this code to make it work for any value.)
558+
Instruction* I = cast<Instruction>(VL);
559+
if (VI.Kills.size() == 1) {
560+
BasicBlock *killBB = VI.Kills[0]->getParent();
561+
if (killBB == I->getParent()) {
562+
return false;
563+
}
564+
}
565+
}
566+
553567
// Loop over all of the successors of the basic block, checking to see if
554568
// the value is either live in the block, or if it is killed in the block.
555569
SmallVector<const BasicBlock*, 8> OpSuccBlocks;

0 commit comments

Comments
 (0)