aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen
diff options
context:
space:
mode:
authorhev <wangrui@loongson.cn>2025-05-22 18:50:40 +0800
committerGitHub <noreply@github.com>2025-05-22 18:50:40 +0800
commit4e186f20e2f2be2fbf95d9713341a0b6507e707d (patch)
tree9b03486674caede80fcd455aaa301769acb59a74 /llvm/lib/CodeGen
parentbd8578c3574d77bc1231f047bced4a0053a1b000 (diff)
downloadllvm-4e186f20e2f2be2fbf95d9713341a0b6507e707d.zip
llvm-4e186f20e2f2be2fbf95d9713341a0b6507e707d.tar.gz
llvm-4e186f20e2f2be2fbf95d9713341a0b6507e707d.tar.bz2
[LoongArch] Fix assertion failure for annotate tablejump (#140907)
Fix a use-after-free issue related to annotateTableJump in the LoongArch target. Previously, `LoongArchPreRAExpandPseudo::annotateTableJump()` recorded a reference to a MachineOperand representing a jump table index. However, later optimizations such as the `BranchFolder` pass may delete the instruction containing this operand, leaving a dangling reference. This led to an assertion failure in `LoongArchAsmPrinter::emitJumpTableInfo()` when trying to access a freed MachineOperand via `getIndex()`. The fix avoids holding a reference to the MachineOperand. Instead, we extract and store the jump table index at the time of annotation. During `emitJumpTableInfo()`, we verify whether the recorded index still exists in the MachineFunction's jump table. If not, we skip emission for that entry. Fixes #140904
Diffstat (limited to 'llvm/lib/CodeGen')
0 files changed, 0 insertions, 0 deletions