[mlir][llvm] Prioritize DILocalScope over file loc
authorChristian Ulmann <christian.ulmann@nextsilicon.com>
Wed, 1 Mar 2023 07:57:59 +0000 (08:57 +0100)
committerChristian Ulmann <christian.ulmann@nextsilicon.com>
Wed, 1 Mar 2023 07:59:06 +0000 (08:59 +0100)
commit475417bbfd43c1ca4ae9309b9f43c3c8cc9b4353
treeb6dc5b5541f545eeec2e2796fe25cad5bbca6799
parent1c112897b20274852a9280d20cebd5c9f3619a7a
[mlir][llvm] Prioritize DILocalScope over file loc

This commit ensures that the LLVMIR export prioritizes existing
DILocalScope attribute information as location scopes over files
constructed from filenames. All DILocalScope attributes contain file
information, so no information is lost. The previous implementation
caused the introduction of superfluous DILexicalBlockFile nodes in
certain cases. The old implementation remains as a fallback when no
DILocalScope is present.

Reviewed By: gysit

Differential Revision: https://reviews.llvm.org/D144968
mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
mlir/lib/Target/LLVMIR/DebugTranslation.cpp
mlir/test/Target/LLVMIR/llvmir-debug.mlir