File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -5598,11 +5598,10 @@ void IRGenSILFunction::visitDebugValueInst(DebugValueInst *i) {
5598
5598
5599
5599
auto VarInfo = i->getVarInfo ();
5600
5600
assert (VarInfo && " debug_value without debug info" );
5601
- if (isa<SILUndef>(SILVal)) {
5601
+ if (isa<SILUndef>(SILVal) && VarInfo-> Name == " $error " ) {
5602
5602
// We cannot track the location of inlined error arguments because it has no
5603
5603
// representation in SIL.
5604
- if (!IsAddrVal &&
5605
- !i->getDebugScope ()->InlinedCallSite && VarInfo->Name == " $error" ) {
5604
+ if (!IsAddrVal && !i->getDebugScope ()->InlinedCallSite ) {
5606
5605
auto funcTy = CurSILFn->getLoweredFunctionType ();
5607
5606
emitErrorResultVar (funcTy, funcTy->getErrorResult (), i);
5608
5607
}
Original file line number Diff line number Diff line change @@ -77,8 +77,10 @@ static bool seemsUseful(SILInstruction *I) {
77
77
}
78
78
79
79
// Is useful if it's associating with a function argument
80
+ // If undef, it is useful and it doesn't cost anything.
80
81
if (isa<DebugValueInst>(I))
81
- return isa<SILFunctionArgument>(I->getOperand (0 ));
82
+ return isa<SILFunctionArgument>(I->getOperand (0 ))
83
+ || isa<SILUndef>(I->getOperand (0 ));
82
84
83
85
return false ;
84
86
}
You can’t perform that action at this time.
0 commit comments