[PATCH] D117861: [SimplifyCFG] Enhance costmodel of FoldTwoEntryPHINode while consider branch misprediction
Kai Luo via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 21 00:54:15 PST 2022
lkail created this revision.
lkail added reviewers: lebedev.ri, spatel, apostolakis, shchenz.
Herald added a subscriber: hiraditya.
lkail requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This is the alternative method based on SimplifyCFG to solve problem mentioned in https://reviews.llvm.org/D113872, i.e., consider code
loop:
...
if (cond) {
// update max/min values
// update indexes of max/min values
}
Currently simplifycfg transforms this snippet of code to
loop:
select cond ...
select cond ...
This is not always profitable since we have redundant computations of select's operands. Branch is not always profitable either since branch may incur high mispredict penalty. This patch uses the cost estimation by @lebedev.ri mentioned in https://reviews.llvm.org/D113872.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D117861
Files:
llvm/lib/Transforms/Utils/SimplifyCFG.cpp
llvm/test/Transforms/SimplifyCFG/two-entry-phi-node-mispredict.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117861.401887.patch
Type: text/x-patch
Size: 8842 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220121/09083192/attachment.bin>
More information about the llvm-commits
mailing list