Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions llvm/include/llvm/CodeGen/TargetInstrInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,10 @@ class LLVM_ABI TargetInstrInfo : public MCInstrInfo {
/// MachineSink determines on its own whether the instruction is safe to sink;
/// this gives the target a hook to override the default behavior with regards
/// to which instructions should be sunk.
///
/// shouldPostRASink() is used by PostRAMachineSink.
virtual bool shouldSink(const MachineInstr &MI) const { return true; }
virtual bool shouldPostRASink(const MachineInstr &MI) const { return true; }

/// Return false if the instruction should not be hoisted by MachineLICM.
///
Expand Down
4 changes: 4 additions & 0 deletions llvm/lib/CodeGen/MachineSink.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2287,6 +2287,10 @@ bool PostRAMachineSinkingImpl::tryToSinkCopy(MachineBasicBlock &CurBB,
continue;
}

// Don't postRASink instructions that the target prefers not to sink.
if (!TII->shouldPostRASink(MI))
continue;

if (MI.isDebugOrPseudoInstr())
continue;

Expand Down