[all-commits] [llvm/llvm-project] b19ec1: [BPI] Improve unreachable/ColdCall heurstics to ha...
taewookoh via All-commits
all-commits at lists.llvm.org
Wed Nov 27 10:36:14 PST 2019
Branch: refs/heads/master
Home: https://github.com/llvm/llvm-project
Commit: b19ec1eb3d0cbb3017e1bc7111efac5643cf4fdd
https://github.com/llvm/llvm-project/commit/b19ec1eb3d0cbb3017e1bc7111efac5643cf4fdd
Author: Taewook Oh <twoh at fb.com>
Date: 2019-11-27 (Wed, 27 Nov 2019)
Changed paths:
M llvm/include/llvm/Analysis/BranchProbabilityInfo.h
M llvm/lib/Analysis/BranchProbabilityInfo.cpp
M llvm/test/Analysis/BranchProbabilityInfo/basic.ll
M llvm/test/Analysis/BranchProbabilityInfo/noreturn.ll
M llvm/test/CodeGen/X86/block-placement.ll
M llvm/test/CodeGen/X86/pr37916.ll
M llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll
Log Message:
-----------
[BPI] Improve unreachable/ColdCall heurstics to handle loops.
Summary:
While updatePostDominatedByUnreachable attemps to find basic blocks that are post-domianted by unreachable blocks, it currently cannot handle loops precisely, because it doesn't use the actual post dominator tree analysis but relies on heuristics of visiting basic blocks in post-order. More precisely, when the entire loop is post-dominated by the unreachable block, current algorithm fails to detect the entire loop as post-dominated by the unreachable because when the algorithm reaches to the loop latch it fails to tell all its successors (including the loop header) will "eventually" be post-domianted by the unreachable block, because the algorithm hasn't visited the loop header yet. This makes BPI for the loop latch to assume that loop backedges are taken with 100% of probability. And because of this, block frequency info sometimes marks virtually dead loops (which are post dominated by unreachable blocks) super hot, because 100% backedge-taken probability makes the loop iteration count the max value. updatePostDominatedByColdCall has the exact same problem as well.
To address this problem, this patch makes PostDominatedByUnreachable/PostDominatedByColdCall to be computed with the actual post-dominator tree.
Reviewers: skatkov, chandlerc, manmanren
Reviewed By: skatkov
Subscribers: manmanren, vsk, apilipenko, Carrot, qcolombet, hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D70104
More information about the All-commits
mailing list