[mlir][LLVM] drop `llvm.intr.dbg.value` when promoting in `SROA` or `mem2reg`
authorMarkus Böck <markus.bock+llvm@nextsilicon.com>
Tue, 4 Jul 2023 15:04:47 +0000 (17:04 +0200)
committerMarkus Böck <markus.bock+llvm@nextsilicon.com>
Tue, 4 Jul 2023 15:15:23 +0000 (17:15 +0200)
commit253f4bfa87f30c6c4def3801fc1bce7b130a8795
treefc7e3e0c12ca9f7ceee511236849ab21c5ce8574
parentda598733544a4e299aebb3552a2c83f680cbd42d
[mlir][LLVM] drop `llvm.intr.dbg.value` when promoting in `SROA` or `mem2reg`

This has previously been done for `llvm.intr.dbg.declare`, which is a common occurrence when the debug info points to the variable through the pointer, but may also occur when the `alloca` itself is a local variable in debug info.

Not doing so prevents `SROA` and `mem2reg` from promoting e.g. an `alloca`. We simply drop the value completetly, since there is no meaninful debug info that can be constructed instead as the pointer value is removed.

Differential Revision: https://reviews.llvm.org/D154451
mlir/include/mlir/Dialect/LLVMIR/LLVMIntrinsicOps.td
mlir/lib/Dialect/LLVMIR/IR/LLVMMemorySlot.cpp
mlir/test/Dialect/LLVMIR/mem2reg-dbginfo.mlir