[PATCH] D110613: [Taildup] Don't tail-duplicate loop header with multiple successors as its latches
Kai Luo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 11 03:29:18 PDT 2021
lkail added a comment.
I agree we should add limitation to such pattern of CFG. If not, quadratic number of edges are added to CFG and hurt compile-time, especially when there are 1K+ cases. The setting of `tail-dup-jmptable-loop-size` might be related to BTB or BTAC, of which I'm not an expert. But for now, we don't want to regress protobuf's compile-time, value of `128` need @alexfh 's confirm.
================
Comment at: llvm/lib/CodeGen/TailDuplicator.cpp:560
+/// Whether there is a loop contains only one large jump table.
+static bool isLargeJumpTableLoop(const MachineBasicBlock *A) {
+ const SmallPtrSet<const MachineBasicBlock *, 8> Preds(A->pred_begin(),
----------------
nit: `A` renamed to `MBB` or `TailBB`.
================
Comment at: llvm/lib/CodeGen/TailDuplicator.cpp:583
+ // Don't tail-duplicate loops that their bodies are large jump table.
+ if (isLargeJumpTableLoop(&TailBB))
----------------
Please add comment to explain why we don't taildup this pattern of CFG.
================
Comment at: llvm/test/CodeGen/X86/tail-dup-multiple-latch-loop.ll:1
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
-; RUN: llc < %s -mtriple=x86_64-unknown-linux-gnu | FileCheck %s
----------------
This test should be pre-committed to show diff.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D110613/new/
https://reviews.llvm.org/D110613
More information about the llvm-commits
mailing list