[llvm] [BranchFolding] Remove getBranchDebugLoc() (PR #114613)
Ellis Hoag via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 19 16:49:50 PST 2024
ellishg wrote:
> This makes sense to me; @SLTozer has been thinking about branch-source-loc merging recently, there aren't any concerns with more parts of LLVM merging branch-source-locs together are there?
I actually removed this code in `MachineBasicBlock::findBranchDebugLoc()` and I didn't see a single test failure. So I don't think it is common for two terminators in the same MBB to have different debug locs.
https://github.com/llvm/llvm-project/blob/012dd8be4b5a4c00deb22345c630990f160b3aa3/llvm/lib/CodeGen/MachineBasicBlock.cpp#L1565-L1567
I also looked at the implementation of `DILocation::getMergedLocation()` and realized that it will clear the line/column of merged locs, which is probably not what we want.
https://github.com/llvm/llvm-project/blob/e394fecd5b351e9108d0600c872759d8dea88a42/llvm/lib/IR/DebugInfoMetadata.cpp#L212-L217
And anyway, I can't find a real-world example that this PR would change. I'm thinking of adding a new parameter like `MergeLocs` to `findBranchDebugLoc()` to preserve the behavior of simply grabbing the last debug loc instead of merging. What do you think?
https://github.com/llvm/llvm-project/pull/114613
More information about the llvm-commits
mailing list