From fb47bb37e4fe7b67bde31bca93d9b31dd55c0caa Mon Sep 17 00:00:00 2001 From: Anton Sidorenko Date: Fri, 18 Nov 2022 12:33:02 +0300 Subject: [MachineTraceMetrics] Pick the trace successor for an entry block We generate erroneous trace for a basic block if it does not have at least one predecessor when MinInstr strategy is used. Currently only this strategy is implemented, so we always have a wrong trace for any entry block. This results in wrong instructions heights calculation and also leads to wrong critical path. The described behavior is demonstrated on a simple test. It shows that early if-conv pass makes wrong decisions due to incorrectly calculated critical path lenght. Differential Revision: https://reviews.llvm.org/D138272 --- llvm/lib/CodeGen/MachineTraceMetrics.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp') diff --git a/llvm/lib/CodeGen/MachineTraceMetrics.cpp b/llvm/lib/CodeGen/MachineTraceMetrics.cpp index 715e5da..dc6746e 100644 --- a/llvm/lib/CodeGen/MachineTraceMetrics.cpp +++ b/llvm/lib/CodeGen/MachineTraceMetrics.cpp @@ -352,7 +352,7 @@ MinInstrCountEnsemble::pickTracePred(const MachineBasicBlock *MBB) { // Select the preferred successor for MBB. const MachineBasicBlock* MinInstrCountEnsemble::pickTraceSucc(const MachineBasicBlock *MBB) { - if (MBB->pred_empty()) + if (MBB->succ_empty()) return nullptr; const MachineLoop *CurLoop = getLoopFor(MBB); const MachineBasicBlock *Best = nullptr; -- cgit v1.1