aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2024-01-24 19:17:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2024-04-06 20:13:49 +0000
commit7a6dacaca14b62ca4b74406814becb87a3fefac0 (patch)
tree273a870ac27484bb1f5ee55e7ef0dc0d061f63e7 /contrib/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp
parent46c59ea9b61755455ff6bf9f3e7b834e1af634ea (diff)
parent4df029cc74e5ec124f14a5682e44999ce4f086df (diff)
Diffstat (limited to 'contrib/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp')
-rw-r--r--contrib/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/contrib/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/contrib/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp
index f5abed0dd517..278111883459 100644
--- a/contrib/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/contrib/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -1589,11 +1589,14 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
for (auto &DPV : I.getDbgValueRange()) {
// Apply the two updates that dbg.values get: invalid operands, and
// variable metadata fixup.
- // FIXME: support dbg.assign form of DPValues.
if (any_of(DPV.location_ops(), IsInvalidLocation)) {
DPVsToDelete.push_back(&DPV);
continue;
}
+ if (DPV.isDbgAssign() && IsInvalidLocation(DPV.getAddress())) {
+ DPVsToDelete.push_back(&DPV);
+ continue;
+ }
if (!DPV.getDebugLoc().getInlinedAt())
DPV.setVariable(GetUpdatedDIVariable(DPV.getVariable()));
DPV.setDebugLoc(DebugLoc::replaceInlinedAtSubprogram(DPV.getDebugLoc(),
@@ -1735,13 +1738,9 @@ CodeExtractor::extractCodeRegion(const CodeExtractorAnalysisCache &CEAC,
NumExitBlocks = ExitBlocks.size();
for (BasicBlock *Block : Blocks) {
- Instruction *TI = Block->getTerminator();
- for (unsigned i = 0, e = TI->getNumSuccessors(); i != e; ++i) {
- if (Blocks.count(TI->getSuccessor(i)))
- continue;
- BasicBlock *OldTarget = TI->getSuccessor(i);
- OldTargets.push_back(OldTarget);
- }
+ for (BasicBlock *OldTarget : successors(Block))
+ if (!Blocks.contains(OldTarget))
+ OldTargets.push_back(OldTarget);
}
// If we have to split PHI nodes of the entry or exit blocks, do so now.