Index: llvm/test/CodeGen/ARM/ParallelDSP/multi-use-loads.ll =================================================================== --- llvm/test/CodeGen/ARM/ParallelDSP/multi-use-loads.ll +++ llvm/test/CodeGen/ARM/ParallelDSP/multi-use-loads.ll @@ -19,8 +19,8 @@ ; CHECK-LE-NEXT: @ =>This Inner Loop Header: Depth=1 ; CHECK-LE-NEXT: ldr lr, [r3, #2]! ; CHECK-LE-NEXT: ldr r4, [r2, #2]! -; CHECK-LE-NEXT: subs r0, #1 ; CHECK-LE-NEXT: sxtah r1, r1, lr +; CHECK-LE-NEXT: subs r0, #1 ; CHECK-LE-NEXT: smlad r12, r4, lr, r12 ; CHECK-LE-NEXT: bne .LBB0_2 ; CHECK-LE-NEXT: @ %bb.3: @ %for.cond.cleanup @@ -215,17 +215,17 @@ ; CHECK-LE-NEXT: cmp r0, #1 ; CHECK-LE-NEXT: blt .LBB2_4 ; CHECK-LE-NEXT: @ %bb.1: @ %for.body.preheader -; CHECK-LE-NEXT: subs r2, #2 +; CHECK-LE-NEXT: sub.w lr, r2, #2 ; CHECK-LE-NEXT: subs r3, #2 ; CHECK-LE-NEXT: mov.w r12, #0 ; CHECK-LE-NEXT: movs r1, #0 ; CHECK-LE-NEXT: .p2align 2 ; CHECK-LE-NEXT: .LBB2_2: @ %for.body ; CHECK-LE-NEXT: @ =>This Inner Loop Header: Depth=1 -; CHECK-LE-NEXT: ldr r4, [r2, #2]! -; CHECK-LE-NEXT: ldr lr, [r3, #2]! -; CHECK-LE-NEXT: asrs r5, r4, #16 -; CHECK-LE-NEXT: smlad r12, r4, lr, r12 +; CHECK-LE-NEXT: ldr r2, [lr, #2]! +; CHECK-LE-NEXT: ldr r4, [r3, #2]! +; CHECK-LE-NEXT: asrs r5, r2, #16 +; CHECK-LE-NEXT: smlad r12, r2, r4, r12 ; CHECK-LE-NEXT: subs r0, #1 ; CHECK-LE-NEXT: mul r1, r5, r1 ; CHECK-LE-NEXT: bne .LBB2_2 Index: llvm/test/CodeGen/ARM/ParallelDSP/unroll-n-jam-smlad.ll =================================================================== --- llvm/test/CodeGen/ARM/ParallelDSP/unroll-n-jam-smlad.ll +++ llvm/test/CodeGen/ARM/ParallelDSP/unroll-n-jam-smlad.ll @@ -46,7 +46,6 @@ ; CHECK-REG-PRESSURE: ldr{{.*}}, [sp ; CHECK-REG-PRESSURE: ldr{{.*}}, [sp ; CHECK-REG-PRESSURE: ldr{{.*}}, [sp -; CHECK-REG-PRESSURE: ldr{{.*}}, [sp ; CHECK-REG-PRESSURE: bne .LBB0_1 for.body: Index: llvm/test/TableGen/InvalidMCSchedClassDesc.td =================================================================== --- /dev/null +++ llvm/test/TableGen/InvalidMCSchedClassDesc.td @@ -0,0 +1,47 @@ +// RUN: llvm-tblgen -gen-subtarget -I %p/../../include %s 2>&1 | FileCheck %s +// Check if it is valid MCSchedClassDesc if didn't have the resources. + +include "llvm/Target/Target.td" + +def MyTarget : Target; + +let OutOperandList = (outs), InOperandList = (ins) in { + def Inst_A : Instruction; + def Inst_B : Instruction; +} + +let CompleteModel = 0 in { + def SchedModel_A: SchedMachineModel; + def SchedModel_B: SchedMachineModel; + def SchedModel_C: SchedMachineModel; +} + +// Inst_B didn't have the resoures, and it is invalid. +// CHECK: SchedModel_ASchedClasses[] = { +// CHECK: {DBGFIELD("Inst_A") 1 +// CHECK-NEXT: {DBGFIELD("Inst_B") 16383 +let SchedModel = SchedModel_A in { + def Write_A : SchedWriteRes<[]>; + def : InstRW<[Write_A], (instrs Inst_A)>; +} + +// Inst_A didn't have the resoures, and it is invalid. +// CHECK: SchedModel_BSchedClasses[] = { +// CHECK: {DBGFIELD("Inst_A") 16383 +// CHECK-NEXT: {DBGFIELD("Inst_B") 1 +let SchedModel = SchedModel_B in { + def Write_B: SchedWriteRes<[]>; + def : InstRW<[Write_B], (instrs Inst_B)>; +} + +// CHECK: SchedModel_CSchedClasses[] = { +// CHECK: {DBGFIELD("Inst_A") 1 +// CHECK-NEXT: {DBGFIELD("Inst_B") 1 +let SchedModel = SchedModel_C in { + def Write_C: SchedWriteRes<[]>; + def : InstRW<[Write_C], (instrs Inst_A, Inst_B)>; +} + +def ProcessorA: ProcessorModel<"ProcessorA", SchedModel_A, []>; +def ProcessorB: ProcessorModel<"ProcessorB", SchedModel_B, []>; +def ProcessorC: ProcessorModel<"ProcessorC", SchedModel_C, []>; Index: llvm/utils/TableGen/SubtargetEmitter.cpp =================================================================== --- llvm/utils/TableGen/SubtargetEmitter.cpp +++ llvm/utils/TableGen/SubtargetEmitter.cpp @@ -1057,6 +1057,7 @@ LLVM_DEBUG(dbgs() << ProcModel.ModelName << " does not have resources for class " << SC.Name << '\n'); + SCDesc.NumMicroOps = MCSchedClassDesc::InvalidNumMicroOps; } } // Sum resources across all operand writes.