aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineInstr.cpp
diff options
context:
space:
mode:
authorhev <wangrui@loongson.cn>2025-11-12 08:51:08 +0800
committerGitHub <noreply@github.com>2025-11-12 08:51:08 +0800
commitea10026b64f66b3b69c0545db20f9daa8579f5cb (patch)
treef4ca25e4838bc354e08c0b9bcda5b20ee947521c /llvm/lib/CodeGen/MachineInstr.cpp
parent79d9ae7a777a03452991d222642ffdb6687d9210 (diff)
downloadllvm-ea10026b64f66b3b69c0545db20f9daa8579f5cb.zip
llvm-ea10026b64f66b3b69c0545db20f9daa8579f5cb.tar.gz
llvm-ea10026b64f66b3b69c0545db20f9daa8579f5cb.tar.bz2
Reland "[LoongArch] Add `isSafeToMove` hook to prevent unsafe instruction motion" (#167465)
This patch introduces a new virtual method `TargetInstrInfo::isSafeToMove()` to allow backends to control whether a machine instruction can be safely moved by optimization passes. The `BranchFolder` pass now respects this hook when hoisting common code. By default, all instructions are considered safe to to move. For LoongArch, `isSafeToMove()` is overridden to prevent relocation-related instruction sequences (e.g. PC-relative addressing and calls) from being broken by instruction motion. Correspondingly, `isSchedulingBoundary()` is updated to reuse this logic for consistency. Relands #163725
Diffstat (limited to 'llvm/lib/CodeGen/MachineInstr.cpp')
0 files changed, 0 insertions, 0 deletions