[llvm] [DebugInfo][InstCombine] Do not overwrite prior DILocation for new Insts (PR #108565)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 07:39:50 PDT 2024


SLTozer wrote:

> If we merge locations on two instructions, but only one has a location, the merged result is no location?

Correct; when we merge locations, we choose the innermost scope that contains both; if either has no location whatsoever (i.e. has no scope), then we can't assign any meaningful location that isn't lying about one of them.

> How often do we get a load with no DILocation in practice? It seems like that would be unusual.

Hard to say, but I uploaded another patch earlier today that fixes a case where we generate loads without a location (https://github.com/llvm/llvm-project/pull/108531); there are also all sorts of ways that DILocations can be dropped right now, and although I'm trying to eliminate as many as possible right now it seems safer to be defensive about the possibility. As a small, not totally reliable, data point, I found ~45 loads generated (at _some_ point) without a DILocation while building [bullet](https://github.com/llvm/llvm-test-suite/tree/main/MultiSource/Benchmarks/Bullet).

https://github.com/llvm/llvm-project/pull/108565


More information about the llvm-commits mailing list