[PATCH] D152534: [NFC][DebugInfo][RemoveDIs] Use moveBeforePreserving when transforms intend to move dbg.values

Jeremy Morse via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 9 06:57:11 PDT 2023


jmorse created this revision.
Herald added subscribers: ormris, hiraditya.
Herald added a project: All.
jmorse requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

As outlined in my proposal for how to get rid of debug intrinsics [0], we need to distinguish in optimisation passes when a pass /intends/ for move instructions to remain in their original order. It's the difference between moving a single instruction because we're hoisting it out of it's original position, and moving a single instruction as part of moving/copying an entire block from one place to another, all in order. This semantic difference has an effect on debug-info, and it needs to be accounted for when we remove debug intrinsics.

The patch just replaces a few calls to moveBefore with calls to moveBeforePreserving -- and the latter just calls the former, so it's all NFC right now. A future patch will add an implementation of moveBeforePreserving that takes action to correctly preserve debug-info, but that's tightly coupled with our non-instruction debug-info representation. This patch just shows how invasive the changes are.

There are, as it transpires, very few places where this makes a difference.

Not adding reviewers for now as I'd like to group all these changes, so that we talk about how they should be tested.

[0] https://discourse.llvm.org/t/rfc-instruction-api-changes-needed-to-eliminate-debug-intrinsics-from-ir/68939


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D152534

Files:
  llvm/include/llvm/IR/Instruction.h
  llvm/lib/CodeGen/SelectOptimize.cpp
  llvm/lib/Frontend/OpenMP/OMPIRBuilder.cpp
  llvm/lib/Transforms/IPO/IROutliner.cpp
  llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
  llvm/lib/Transforms/Scalar/LoopInterchange.cpp
  llvm/lib/Transforms/Scalar/MergeICmps.cpp
  llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
  llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
  llvm/lib/Transforms/Utils/CodeMoverUtils.cpp
  llvm/lib/Transforms/Utils/SimplifyCFG.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D152534.529914.patch
Type: text/x-patch
Size: 7227 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230609/e4f21cc4/attachment.bin>


More information about the llvm-commits mailing list