Skip to content

Commit 93d445c

Browse files
authored
[PostRASink] Add target hook shouldPostRASink (#167182)
1 parent 8cc49fb commit 93d445c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

llvm/include/llvm/CodeGen/TargetInstrInfo.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,10 @@ class LLVM_ABI TargetInstrInfo : public MCInstrInfo {
436436
/// MachineSink determines on its own whether the instruction is safe to sink;
437437
/// this gives the target a hook to override the default behavior with regards
438438
/// to which instructions should be sunk.
439+
///
440+
/// shouldPostRASink() is used by PostRAMachineSink.
439441
virtual bool shouldSink(const MachineInstr &MI) const { return true; }
442+
virtual bool shouldPostRASink(const MachineInstr &MI) const { return true; }
440443

441444
/// Return false if the instruction should not be hoisted by MachineLICM.
442445
///

llvm/lib/CodeGen/MachineSink.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2287,6 +2287,10 @@ bool PostRAMachineSinkingImpl::tryToSinkCopy(MachineBasicBlock &CurBB,
22872287
continue;
22882288
}
22892289

2290+
// Don't postRASink instructions that the target prefers not to sink.
2291+
if (!TII->shouldPostRASink(MI))
2292+
continue;
2293+
22902294
if (MI.isDebugOrPseudoInstr())
22912295
continue;
22922296

0 commit comments

Comments
 (0)