[PATCH] D70104: [BPI] Improve unreachable/ColdCall heurstics to handle loops.
Taewook Oh via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Nov 11 16:55:17 PST 2019
twoh created this revision.
twoh added reviewers: skatkov, chandlerc.
Herald added subscribers: hiraditya, qcolombet.
Herald added a project: LLVM.
twoh updated this revision to Diff 228783.
twoh added a comment.
Add "CHECK" for the test.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D70104
Files:
llvm/include/llvm/Analysis/BranchProbabilityInfo.h
llvm/lib/Analysis/BranchProbabilityInfo.cpp
llvm/test/Analysis/BranchProbabilityInfo/basic.ll
llvm/test/Analysis/BranchProbabilityInfo/noreturn.ll
llvm/test/CodeGen/X86/block-placement.ll
llvm/test/CodeGen/X86/pr37916.ll
llvm/test/CodeGen/X86/ragreedy-hoist-spill.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D70104.228783.patch
Type: text/x-patch
Size: 24434 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20191112/3420b107/attachment.bin>
More information about the llvm-commits
mailing list