Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 15 additions & 2 deletions llvm/lib/Target/AMDGPU/SIInsertHardClauses.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ using namespace llvm;

#define DEBUG_TYPE "si-insert-hard-clauses"

static cl::opt<unsigned>
HardClauseLengthLimit("amdgpu-hard-clause-length-limit",
cl::desc("Maximum number of memory instructions to "
"place in the same hard clause"),
cl::init(255), cl::Hidden);

namespace {

enum HardClauseType {
Expand Down Expand Up @@ -185,11 +191,18 @@ class SIInsertHardClauses {
}

bool run(MachineFunction &MF) {

ST = &MF.getSubtarget<GCNSubtarget>();
if (!ST->hasHardClauses())
return false;

unsigned MaxClauseLength = MF.getFunction().getFnAttributeAsParsedInteger(
"amdgpu-hard-clause-length-limit", HardClauseLengthLimit);
if (HardClauseLengthLimit.getNumOccurrences())
MaxClauseLength = HardClauseLengthLimit;
MaxClauseLength = std::min(MaxClauseLength, ST->maxHardClauseLength());
if (!MaxClauseLength)
return false;

const SIInstrInfo *SII = ST->getInstrInfo();
const TargetRegisterInfo *TRI = ST->getRegisterInfo();

Expand All @@ -212,7 +225,7 @@ class SIInsertHardClauses {
}
}

if (CI.Length == ST->maxHardClauseLength() ||
if (CI.Length == MaxClauseLength ||
(CI.Length && Type != HARDCLAUSE_INTERNAL &&
Type != HARDCLAUSE_IGNORE &&
(Type != CI.Type ||
Expand Down
Loading
Loading