llvm-project/llvm/test/TableGen/ReadAdvanceInvalidWrite.td
Visoiu Mistrih Francis b791a51730
[CodeGenSchedule] Don't allow invalid ReadAdvances to be formed (#82685)
Forming a `ReadAdvance` with an entry in the `ValidWrites` list that is
not used by any instruction results in the entire `ReadAdvance` to be
ignored by the scheduler due to an invalid entry.

The `SchedRW` collection code only picks up `SchedWrites` that are
reachable from `Instructions`, `InstRW`, `ItinRW` and `SchedAlias`,
leaving the unreachable ones with an invalid entry (0) in
`SubtargetEmitter::GenSchedClassTables` when going through the list of
`ReadAdvances`
2024-02-26 18:25:21 -08:00

30 lines
766 B
TableGen

// RUN: not llvm-tblgen -gen-subtarget -I %p/../../include %s 2>&1 | FileCheck %s
// Make sure we don't form ReadAdvances with ValidWrites entries that are not
// associated with any instructions.
include "llvm/Target/Target.td"
def TargetX : Target;
def WriteX : SchedWrite;
def WriteY : SchedWrite;
def ReadX : SchedRead;
def InstX : Instruction {
let OutOperandList = (outs);
let InOperandList = (ins);
let SchedRW = [WriteX, ReadX];
}
def SchedModelX: SchedMachineModel {
let CompleteModel = 0;
}
let SchedModel = SchedModelX in {
def : ReadAdvance<ReadX, 1, [WriteX, WriteY]>;
// CHECK: error: ReadAdvance referencing a ValidWrite that is not used by any instruction (WriteY)
}
def ProcessorX: ProcessorModel<"ProcessorX", SchedModelX, []>;