mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
[DebugInfo][SIL] Introduce the 'implicit' attribute for debug variable
Debug variables that are marked 'implicit' on its `debug_value` instruction mean that they were generated by compiler. Optimizers are free to remove them (if it becomes a dead code, for instance) even in -Onone. Since they are barely used by users and keeping them might lead to incorrect IRGen results.
This commit is contained in:
@@ -222,7 +222,11 @@ bool swift::hasOnlyEndOfScopeOrDestroyUses(SILInstruction *inst) {
|
||||
// Include debug uses only in Onone mode.
|
||||
if (isDebugUser && inst->getFunction()->getEffectiveOptimizationMode() <=
|
||||
OptimizationMode::NoOptimization)
|
||||
return false;
|
||||
if (auto DbgVarInst = DebugVarCarryingInst(user)) {
|
||||
auto VarInfo = DbgVarInst.getVarInfo();
|
||||
if (VarInfo && !VarInfo->Implicit)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user