aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Morse <jeremy.morse@sony.com>2024-01-23 16:23:48 +0000
committerGitHub <noreply@github.com>2024-01-23 16:23:48 +0000
commit4782ac8dd3cfa96e14ad4eff1389bbcfda27240f (patch)
tree6a53ea9218b7a81f34dbb1eff6aed91de8a32ab4
parent6bb7d515c3577afbae9293caa050e02643a19355 (diff)
downloadllvm-4782ac8dd3cfa96e14ad4eff1389bbcfda27240f.zip
llvm-4782ac8dd3cfa96e14ad4eff1389bbcfda27240f.tar.gz
llvm-4782ac8dd3cfa96e14ad4eff1389bbcfda27240f.tar.bz2
[DebugInfo][RemoveDIs] Use splice in Outliner rather than moveBefore (#79124)
This patch replaces a utility in the outliner that moves the contents of one basic block into another basic block, with a call to splice instead. I think it's NFC, however I'd like a second pair of eyes to look at it just in case. The reason for doing this is an edge case in the handling of DPValue objects, the replacement for dbg.values. If there's a variable assignment "dangling" at the end of a block (which happens when we delete the terminator), inserting instructions at end() doesn't shift the DPValue up into the block. We could probably fix this; but it's much easier to use splice at the only call site that does this. Patch adds --try-experimental-debuginfo-iterators to a test to exercise this code path.
-rw-r--r--llvm/lib/Transforms/IPO/IROutliner.cpp3
-rw-r--r--llvm/test/Transforms/IROutliner/legal-debug.ll1
2 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index a6e19df..8e6d0e8 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -154,8 +154,7 @@ struct OutlinableGroup {
/// \param SourceBB - the BasicBlock to pull Instructions from.
/// \param TargetBB - the BasicBlock to put Instruction into.
static void moveBBContents(BasicBlock &SourceBB, BasicBlock &TargetBB) {
- for (Instruction &I : llvm::make_early_inc_range(SourceBB))
- I.moveBeforePreserving(TargetBB, TargetBB.end());
+ TargetBB.splice(TargetBB.end(), &SourceBB);
}
/// A function to sort the keys of \p Map, which must be a mapping of constant
diff --git a/llvm/test/Transforms/IROutliner/legal-debug.ll b/llvm/test/Transforms/IROutliner/legal-debug.ll
index b7b472f..be1182b 100644
--- a/llvm/test/Transforms/IROutliner/legal-debug.ll
+++ b/llvm/test/Transforms/IROutliner/legal-debug.ll
@@ -1,5 +1,6 @@
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs
; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s | FileCheck %s
+; RUN: opt -S -passes=verify,iroutliner -ir-outlining-no-cost < %s --try-experimental-debuginfo-iterators | FileCheck %s
; This test checks that debug info is recognized as able to be extracted along
; with the other instructions, but is not included in the consolidated function.