CFI pseudo-instructions emit nothing to the .text section, therefore there's no reason to emit their source locations into the line table.
In practice, a CFI instruction's source location will be one of three things: (a) exactly the same as the preceding instruction; (b) exactly the same as the following instruction; (c) unspecified. The first two cases have no net effect on the line table. The third case will emit a "line 0" record whenever we turn unspecified locations into "line 0" which can happen with -use-unknown-locations or, after the patch in D24180 lands (again), if the CFI instruction happens to be at the top of a basic block. This patch causes the third case to have no net effect on the line table, just like the other cases.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
Seems reasonable.
test/DebugInfo/Generic/no-cfi-loc.ll | ||
---|---|---|
2 ↗ | (On Diff #80503) | Short comment on what is being checked here? |
test/DebugInfo/Generic/no-cfi-loc.ll | ||
---|---|---|
2 ↗ | (On Diff #80503) | It ends up emitting a CFI instruction with no debug location. The test is verifying that this does not result in a line-0 record (that we skip the CFI instruction). Although, I now realize the fact that there is a CFI instruction at all is not obvious! Maybe I should turn this into an MIR test instead. |
test/DebugInfo/Generic/no-cfi-loc.ll | ||
---|---|---|
2 ↗ | (On Diff #80503) | My main point was that a test like this would work even if you symlink llc to /usr/bin/true. I would suggest to at least check for the function label and one other .loc directive that is expected to be in the output. |
test/DebugInfo/Generic/no-cfi-loc.ll | ||
---|---|---|
2 ↗ | (On Diff #80503) | Sorry, didn't see this before I committed. The new test does look for the .cfi directive, and verifies that no line-0 directive appears before that. |