swift
24613080 - SILMem2Reg: Fix debug scope of debug_value for empty tuple values

Commit
24 days ago
SILMem2Reg: Fix debug scope of debug_value for empty tuple values Commit 0ef2094279969bc8af96d5e3108d2443b5980c8e salvages more debug information in Mem2Reg in several cases. It propagates the information from the alloc_stack to the replaced load instructions. However, there are cases where the loads from an alloca are not actually representing loads from the respective local variable. One such case is when there is mandatory inlining happening at the start of the pipeline. For example, consider the example below where an identity function is inlined. The resulting SIL will contain an alloca from the outer `result` and a load that is the leftover after the closure (which is just a load of the passed argument). The load that is created has its debug scope (correctly) in the closure scope, but the loaded alloc_stack is actually the outer local variable. The intermediate `result` that is passed to the closure is getting eliminated by the inliner. ``` let result = try await ... // becomes empty tuple. return withExtendedLifetime((...)) { result } ``` This patch forces that the scope of the debug_value describing result is actually in the outer function and describes the right `result` local. Fixes rdar://171023691
Author
Committer
Parents
Loading