From 943671ba37af9642eedd2a12a166db38006fe67b Mon Sep 17 00:00:00 2001 From: cfang Date: Tue, 5 May 2009 11:02:10 -0700 Subject: [PATCH] 6833879: Assigning positive zero is ignored when old value is negative zero Summary: Don't perform CMOVE identity optimization for floating point types Reviewed-by: kvn, never --- src/share/vm/opto/connode.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/share/vm/opto/connode.cpp b/src/share/vm/opto/connode.cpp index 46f13c652..9e82a8e44 100644 --- a/src/share/vm/opto/connode.cpp +++ b/src/share/vm/opto/connode.cpp @@ -128,6 +128,10 @@ Node *CMoveNode::is_cmove_id( PhaseTransform *phase, Node *cmp, Node *t, Node *f // Swapped Cmp is OK (phase->eqv(cmp->in(2),f) && phase->eqv(cmp->in(1),t)) ) { + // Give up this identity check for floating points because it may choose incorrect + // value around 0.0 and -0.0 + if ( cmp->Opcode()==Op_CmpF || cmp->Opcode()==Op_CmpD ) + return NULL; // Check for "(t==f)?t:f;" and replace with "f" if( b->_test._test == BoolTest::eq ) return f; -- GitLab