Skip to content

Commit e1395ac

Browse files
trbauerigcbot
authored andcommitted
[Autobackout][FuncReg]Revert of change: e2d4d33
remove dead instructions with debug info enabled. This change removes IGC backend pattern match dependency setting on arguments to debug instructions. call void @llvm.dbg.value(metadata float %8, metadata !903, metadata !DIExpression()), !dbg !901 ; visa id: 20 This forces generation of instruction producing %8. However, if that instruction is not used, it will be generated in dead code. For example, %8 = load float, float addrspace(1)* %7, align 4, !dbg !902 ; visa id: 18 ... %simdShuffle = call float @llvm.genx.GenISA.WaveShuffleIndex.f32(float %8, i32 0, i32 0), !dbg !981 ; visa id: 23 ... call void @llvm.dbg.value(metadata float %simdShuffle, metadata !904, metadata !DIExpression()), !dbg !901 ; visa id: 26 ... %9 = fadd fast float %simdShuffle, %simdShuffle.1, !dbg !982 ; visa id: 30 The pattern matcher will link out %simdShuffle and directly use %8 (regioning), However, llvm.dbg.value creates a false dependency on %simdShuffle and causes the shuffle to emit a dead broadcast mov in vISA. This change wouldn't impact in -O0 debug mode, and just impact -O2 debug mode.
1 parent 4ec5f04 commit e1395ac

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

IGC/Compiler/CISACodeGen/PatternMatchPass.cpp

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1515,7 +1515,7 @@ namespace IGC
15151515

15161516
void CodeGenPatternMatch::visitDbgInfoIntrinsic(DbgInfoIntrinsic& I)
15171517
{
1518-
// Nothing to do
1518+
MatchDbgInstruction(I);
15191519
}
15201520

15211521
void CodeGenPatternMatch::visitInsertValueInst(InsertValueInst& I)
@@ -4970,6 +4970,38 @@ namespace IGC
49704970
return MatchSingleInstruction(I);
49714971
}
49724972

4973+
bool CodeGenPatternMatch::MatchDbgInstruction(llvm::DbgInfoIntrinsic& I)
4974+
{
4975+
struct DbgInstPattern : Pattern
4976+
{
4977+
virtual void Emit(EmitPass* pass, const DstModifier& modifier)
4978+
{
4979+
// Nothing to emit.
4980+
}
4981+
};
4982+
DbgInstPattern* pattern = new (m_allocator) DbgInstPattern();
4983+
if (DbgDeclareInst * pDbgDeclInst = dyn_cast<DbgDeclareInst>(&I))
4984+
{
4985+
if (pDbgDeclInst->getAddress())
4986+
{
4987+
MarkAsSource(pDbgDeclInst->getAddress());
4988+
}
4989+
}
4990+
else if (DbgValueInst * pDbgValInst = dyn_cast<DbgValueInst>(&I))
4991+
{
4992+
if (pDbgValInst->getValue())
4993+
{
4994+
MarkAsSource(pDbgValInst->getValue());
4995+
}
4996+
}
4997+
else
4998+
{
4999+
IGC_ASSERT_MESSAGE(0, "Unhandled Dbg intrinsic");
5000+
}
5001+
AddPattern(pattern);
5002+
return true;
5003+
}
5004+
49735005
bool CodeGenPatternMatch::MatchAvg(llvm::Instruction& I)
49745006
{
49755007
// "Average value" pattern:

IGC/Compiler/CISACodeGen/PatternMatchPass.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ namespace IGC
224224
bool MatchBlockReadWritePointer(llvm::GenIntrinsicInst& I);
225225
bool MatchGradient(llvm::GenIntrinsicInst& I);
226226
bool MatchSampleDerivative(llvm::GenIntrinsicInst& I);
227+
bool MatchDbgInstruction(llvm::DbgInfoIntrinsic& I);
227228
bool MatchAvg(llvm::Instruction& I);
228229

229230
bool MatchMinMax(llvm::SelectInst& I);

0 commit comments

Comments
 (0)