diff options
| author | hev <wangrui@loongson.cn> | 2025-11-12 08:51:08 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-12 08:51:08 +0800 |
| commit | ea10026b64f66b3b69c0545db20f9daa8579f5cb (patch) | |
| tree | f4ca25e4838bc354e08c0b9bcda5b20ee947521c /llvm/unittests/Transforms/Utils/LocalTest.cpp | |
| parent | 79d9ae7a777a03452991d222642ffdb6687d9210 (diff) | |
| download | llvm-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/unittests/Transforms/Utils/LocalTest.cpp')
0 files changed, 0 insertions, 0 deletions
