aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineTraceMetrics.cpp
diff options
context:
space:
mode:
authorAnton Sidorenko <anton.sidorenko@syntacore.com>2022-11-18 12:33:02 +0300
committerAnton Sidorenko <anton.sidorenko@syntacore.com>2022-11-21 12:56:40 +0300
commitfb47bb37e4fe7b67bde31bca93d9b31dd55c0caa (patch)
treeae652ab39755e59c6bb7ae8fb1220c36b16154a4 /llvm/lib/CodeGen/MachineTraceMetrics.cpp
parent0c22cdfdd1bff6b0fddba8124ab5478884d1629c (diff)
downloadllvm-fb47bb37e4fe7b67bde31bca93d9b31dd55c0caa.zip
llvm-fb47bb37e4fe7b67bde31bca93d9b31dd55c0caa.tar.gz
llvm-fb47bb37e4fe7b67bde31bca93d9b31dd55c0caa.tar.bz2
[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
Diffstat (limited to 'llvm/lib/CodeGen/MachineTraceMetrics.cpp')
-rw-r--r--llvm/lib/CodeGen/MachineTraceMetrics.cpp2
1 files changed, 1 insertions, 1 deletions
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;