aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/BranchFolding.cpp
diff options
context:
space:
mode:
authorOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-07-29 08:36:12 +0100
committerOrlando Cazalet-Hyams <orlando.hyams@sony.com>2025-07-29 09:09:58 +0100
commit5dab1fa1fa174085a9f265ff25763a31af97c9e3 (patch)
tree094d15bcb2c13e10645a76e5457d371d8482cedb /llvm/lib/CodeGen/BranchFolding.cpp
parent0d21522c00e2bda466834b43af5839eedc4e36bd (diff)
downloadllvm-5dab1fa1fa174085a9f265ff25763a31af97c9e3.zip
llvm-5dab1fa1fa174085a9f265ff25763a31af97c9e3.tar.gz
llvm-5dab1fa1fa174085a9f265ff25763a31af97c9e3.tar.bz2
[BranchFolding] Follow up #149999 crash fix
fbf6271c7da20356d7b34583b3711b4126ca1dbb introduced an assertion failure as setDebugValueUndef was called on DBG_LABELs, which isn't allowed and doesn't make sense. Fix by skipping the call for DBG_LABELs and hoisting, in line with the original behaviour.
Diffstat (limited to 'llvm/lib/CodeGen/BranchFolding.cpp')
-rw-r--r--llvm/lib/CodeGen/BranchFolding.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/CodeGen/BranchFolding.cpp b/llvm/lib/CodeGen/BranchFolding.cpp
index a7c99b1..dcfd9aa 100644
--- a/llvm/lib/CodeGen/BranchFolding.cpp
+++ b/llvm/lib/CodeGen/BranchFolding.cpp
@@ -2103,8 +2103,9 @@ bool BranchFolder::HoistCommonCodeInSuccs(MachineBasicBlock *MBB) {
DI->eraseFromParent();
return;
}
-
- DI->setDebugValueUndef();
+ // Move DBG_LABELs without modifying them. Set DBG_VALUEs undef.
+ if (!DI->isDebugLabel())
+ DI->setDebugValueUndef();
DI->moveBefore(&*Loc);
};