[llvm] [BranchFolding] Remove getBranchDebugLoc() (PR #114613)

Stephen Tozer via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 17 10:19:21 PST 2025


SLTozer wrote:

Just for the extra context, I recently did some hunting to find a case where two terminators in a block had different locations, and I also couldn't find any such cases - though I was looking mainly at x86, I did also try to search for any cases where they would be generated for other targets. I agree with @jmorse that if the DebugLocs were different, and we selected one of those DebugLocs arbitrarily (e.g. whichever comes last), we'd sometimes generate incorrect debug info; I'd say using the merged location is the best bet given the assumption that the locs will almost always (and probably actually always) be the same.

If we were concerned about dropping information, I'd note that in almost all the calls to `getBranchDebugLoc()` we're really modifying a specific known branch instruction, so could use that known branch's DebugLoc instead of an MBB method.

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


More information about the llvm-commits mailing list