aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/CodeGenPrepare.cpp
diff options
context:
space:
mode:
authorHiroshi Yamauchi <yamauchi@google.com>2020-01-21 15:49:04 -0800
committerHiroshi Yamauchi <yamauchi@google.com>2020-01-22 08:36:54 -0800
commitddbc728828c70728473b47c9f7427aa9514f3d17 (patch)
tree0cd68d62abb5f8491f4d5c1957194c99be22e451 /llvm/lib/CodeGen/CodeGenPrepare.cpp
parenta8ff6c0b09718a048ec9b9fc7db33fd39f6500cc (diff)
downloadllvm-ddbc728828c70728473b47c9f7427aa9514f3d17.zip
llvm-ddbc728828c70728473b47c9f7427aa9514f3d17.tar.gz
llvm-ddbc728828c70728473b47c9f7427aa9514f3d17.tar.bz2
[PGO][PGSO] Update BFI in CodeGenPrepare::optimizeSelectInst.
Summary: Without the BFI update, some hot blocks are incorrectly treated as cold code. This fixes a FDO perf regression in the TSVC benchmark from D71288. Reviewers: davidxl Subscribers: hiraditya, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D73146
Diffstat (limited to 'llvm/lib/CodeGen/CodeGenPrepare.cpp')
-rw-r--r--llvm/lib/CodeGen/CodeGenPrepare.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index 9639336..a44d965 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -6138,6 +6138,7 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
BasicBlock *StartBlock = SI->getParent();
BasicBlock::iterator SplitPt = ++(BasicBlock::iterator(LastSI));
BasicBlock *EndBlock = StartBlock->splitBasicBlock(SplitPt, "select.end");
+ BFI->setBlockFreq(EndBlock, BFI->getBlockFreq(StartBlock).getFrequency());
// Delete the unconditional branch that was just created by the split.
StartBlock->getTerminator()->eraseFromParent();