Skip to content

Commit

Permalink
8334629: [BACKOUT] PhaseIdealLoop::conditional_move is too conservative
Browse files Browse the repository at this point in the history
Reviewed-by: chagedorn, qamai
Backport-of: 933eaba
  • Loading branch information
TobiHartmann committed Jun 26, 2024
1 parent d151050 commit 2086b0f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 65 deletions.
19 changes: 13 additions & 6 deletions src/hotspot/share/opto/loopopts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -795,18 +795,25 @@ Node *PhaseIdealLoop::conditional_move( Node *region ) {
// Avoid duplicated float compare.
if (phis > 1 && (cmp_op == Op_CmpF || cmp_op == Op_CmpD)) return nullptr;

// Ignore cost if CMOVE can be moved outside the loop.
if (used_inside_loop && cost >= ConditionalMoveLimit) {
return nullptr;
float infrequent_prob = PROB_UNLIKELY_MAG(3);
// Ignore cost and blocks frequency if CMOVE can be moved outside the loop.
if (used_inside_loop) {
if (cost >= ConditionalMoveLimit) return nullptr; // Too much goo

// BlockLayoutByFrequency optimization moves infrequent branch
// from hot path. No point in CMOV'ing in such case (110 is used
// instead of 100 to take into account not exactness of float value).
if (BlockLayoutByFrequency) {
infrequent_prob = MAX2(infrequent_prob, (float)BlockLayoutMinDiamondPercentage/110.0f);
}
}
// Check for highly predictable branch. No point in CMOV'ing if
// we are going to predict accurately all the time.
constexpr float infrequent_prob = PROB_UNLIKELY_MAG(2);
if (C->use_cmove() && (cmp_op == Op_CmpF || cmp_op == Op_CmpD)) {
//keep going
} else if (iff->_prob < infrequent_prob || iff->_prob > (1.0f - infrequent_prob)) {
} else if (iff->_prob < infrequent_prob ||
iff->_prob > (1.0f - infrequent_prob))
return nullptr;
}

// --------------
// Now replace all Phis with CMOV's
Expand Down
1 change: 1 addition & 0 deletions test/hotspot/jtreg/ProblemList.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ compiler/c2/Test8004741.java 8235801 generic-all
compiler/c2/TestMergeStores.java#id0 8331311 generic-ppc64,linux-s390x
compiler/c2/TestMergeStores.java#id1 8331311 generic-ppc64,linux-s390x
compiler/c2/irTests/TestDuplicateBackedge.java 8318904 generic-all
compiler/c2/irTests/TestIfMinMax.java 8334816 generic-all

compiler/codecache/jmx/PoolsIndependenceTest.java 8264632 macosx-all
compiler/codecache/CheckLargePages.java 8332654 linux-x64
Expand Down
59 changes: 0 additions & 59 deletions test/micro/org/openjdk/bench/vm/compiler/CMove.java

This file was deleted.

1 comment on commit 2086b0f

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.