Skip to content

Commit 2086b0f

Browse files
committed
8334629: [BACKOUT] PhaseIdealLoop::conditional_move is too conservative
Reviewed-by: chagedorn, qamai Backport-of: 933eaba
1 parent d151050 commit 2086b0f

File tree

3 files changed

+14
-65
lines changed

3 files changed

+14
-65
lines changed

src/hotspot/share/opto/loopopts.cpp

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -795,18 +795,25 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) {
795795
// Avoid duplicated float compare.
796796
if (phis > 1 && (cmp_op == Op_CmpF || cmp_op == Op_CmpD)) return nullptr;
797797

798-
// Ignore cost if CMOVE can be moved outside the loop.
799-
if (used_inside_loop && cost >= ConditionalMoveLimit) {
800-
return nullptr;
798+
float infrequent_prob = PROB_UNLIKELY_MAG(3);
799+
// Ignore cost and blocks frequency if CMOVE can be moved outside the loop.
800+
if (used_inside_loop) {
801+
if (cost >= ConditionalMoveLimit) return nullptr; // Too much goo
802+
803+
// BlockLayoutByFrequency optimization moves infrequent branch
804+
// from hot path. No point in CMOV'ing in such case (110 is used
805+
// instead of 100 to take into account not exactness of float value).
806+
if (BlockLayoutByFrequency) {
807+
infrequent_prob = MAX2(infrequent_prob, (float)BlockLayoutMinDiamondPercentage/110.0f);
808+
}
801809
}
802810
// Check for highly predictable branch. No point in CMOV'ing if
803811
// we are going to predict accurately all the time.
804-
constexpr float infrequent_prob = PROB_UNLIKELY_MAG(2);
805812
if (C->use_cmove() && (cmp_op == Op_CmpF || cmp_op == Op_CmpD)) {
806813
//keep going
807-
} else if (iff->_prob < infrequent_prob || iff->_prob > (1.0f - infrequent_prob)) {
814+
} else if (iff->_prob < infrequent_prob ||
815+
iff->_prob > (1.0f - infrequent_prob))
808816
return nullptr;
809-
}
810817

811818
// --------------
812819
// Now replace all Phis with CMOV's

test/hotspot/jtreg/ProblemList.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ compiler/c2/Test8004741.java 8235801 generic-all
6767
compiler/c2/TestMergeStores.java#id0 8331311 generic-ppc64,linux-s390x
6868
compiler/c2/TestMergeStores.java#id1 8331311 generic-ppc64,linux-s390x
6969
compiler/c2/irTests/TestDuplicateBackedge.java 8318904 generic-all
70+
compiler/c2/irTests/TestIfMinMax.java 8334816 generic-all
7071

7172
compiler/codecache/jmx/PoolsIndependenceTest.java 8264632 macosx-all
7273
compiler/codecache/CheckLargePages.java 8332654 linux-x64

test/micro/org/openjdk/bench/vm/compiler/CMove.java

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)