diff options
author | Jeremy Morse <jeremy.morse@sony.com> | 2023-06-07 16:00:15 +0100 |
---|---|---|
committer | Jeremy Morse <jeremy.morse@sony.com> | 2023-11-24 15:17:32 +0000 |
commit | 59fab2264217648ff11412666b69fb4c5fc9451c (patch) | |
tree | 0d12b12f9baf3ef5f91e6cf92426dc5bcfa22be7 /llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | |
parent | 2f7c050e1943f63af0823c1327b44579d0bdb584 (diff) | |
download | llvm-59fab2264217648ff11412666b69fb4c5fc9451c.zip llvm-59fab2264217648ff11412666b69fb4c5fc9451c.tar.gz llvm-59fab2264217648ff11412666b69fb4c5fc9451c.tar.bz2 |
[DebugInfo][RemoveDIs] Support cloning and remapping DPValues (#72546)
This patch adds support for CloneBasicBlock duplicating the DPValues
attached to instructions, and adds facilities to remap them into their new
context. The plumbing to achieve this is fairly straightforwards and
mechanical.
I've also added illustrative uses to LoopUnrollRuntime, SimpleLoopUnswitch
and SimplifyCFG. The former only updates for the epilogue right now so I've
added CHECK lines just for the end of an unrolled loop (further updates
coming later). SimpleLoopUnswitch had no debug-info tests so I've added a
new one. The two modified parts of SimplifyCFG are covered by the two
modified SimplifyCFG tests.
These are scenarios where we have to do extra cloning for copying of
DPValues because they're no longer instructions, and remap them too.
Diffstat (limited to 'llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index 1c88500..612f699 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -913,9 +913,12 @@ bool llvm::UnrollRuntimeLoopRemainder( // Rewrite the cloned instruction operands to use the values created when the // clone is created. for (BasicBlock *BB : NewBlocks) { + Module *M = BB->getModule(); for (Instruction &I : *BB) { RemapInstruction(&I, VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); + RemapDPValueRange(M, I.getDbgValueRange(), VMap, + RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); } } |