From c858e99116d420fcc9e0e3292b65e011eb6651c2 Mon Sep 17 00:00:00 2001 From: Martien de Jong Date: Wed, 9 Oct 2024 12:17:53 +0200 Subject: [PATCH] [AIE] Fix PostPipeliner crash We can't check LCDs for NCopies=1, but it also never gives a useful schedule. --- llvm/lib/Target/AIE/AIEPostPipeliner.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/llvm/lib/Target/AIE/AIEPostPipeliner.cpp b/llvm/lib/Target/AIE/AIEPostPipeliner.cpp index 950ea4ccfbad..e20b59c57b5f 100644 --- a/llvm/lib/Target/AIE/AIEPostPipeliner.cpp +++ b/llvm/lib/Target/AIE/AIEPostPipeliner.cpp @@ -330,15 +330,19 @@ bool PostPipeliner::scheduleOtherIterations() { } bool PostPipeliner::schedule(ScheduleDAGMI &TheDAG, int InitiationInterval) { + NTotalInstrs = TheDAG.SUnits.size(); + assert(NTotalInstrs % NInstr == 0); + NCopies = NTotalInstrs / NInstr; + if (NCopies == 1) { + LLVM_DEBUG(dbgs() << "PostPipeliner: Not feasible\n"); + return false; + } II = InitiationInterval; DAG = &TheDAG; - NTotalInstrs = DAG->SUnits.size(); FirstUnscheduled = 0; - assert(NTotalInstrs % NInstr == 0); // Let's not skimp on size here. This allows us to insert any instruction // in the unrolled dag. - NCopies = NTotalInstrs / NInstr; Depth = NCopies * II + HR.getPipelineDepth(); Scoreboard.reset(Depth);