[all-commits] [llvm/llvm-project] 4e186f: [LoongArch] Fix assertion failure for annotate tab...
hev via All-commits
all-commits at lists.llvm.org
Thu May 22 03:51:03 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 4e186f20e2f2be2fbf95d9713341a0b6507e707d
https://github.com/llvm/llvm-project/commit/4e186f20e2f2be2fbf95d9713341a0b6507e707d
Author: hev <wangrui at loongson.cn>
Date: 2025-05-22 (Thu, 22 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
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