[all-commits] [llvm/llvm-project] 6fcb1c: [LoongArch] Fix assertion failure for annotate tab...
hev via All-commits
all-commits at lists.llvm.org
Fri May 23 21:11:15 PDT 2025
Branch: refs/heads/release/20.x
Home: https://github.com/llvm/llvm-project
Commit: 6fcb1c127b407cd6cb731bcc39efb360643b8d25
https://github.com/llvm/llvm-project/commit/6fcb1c127b407cd6cb731bcc39efb360643b8d25
Author: hev <wangrui at loongson.cn>
Date: 2025-05-23 (Fri, 23 May 2025)
Changed paths:
M llvm/lib/Target/LoongArch/LoongArchAsmPrinter.cpp
M llvm/lib/Target/LoongArch/LoongArchExpandPseudoInsts.cpp
M llvm/lib/Target/LoongArch/LoongArchMachineFunctionInfo.h
Log Message:
-----------
[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
(cherry picked from commit 4e186f20e2f2be2fbf95d9713341a0b6507e707d)
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list