< prev index next >
src/share/vm/opto/loopTransform.cpp
Print this page
*** 1,7 ****
/*
! * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 206,216 ****
// (inv2 - x) + inv1 => ( inv1 + inv2) - x
// (inv2 - x) - inv1 => (-inv1 + inv2) - x
// inv1 - (x + inv2) => ( inv1 - inv2) - x
//
Node* IdealLoopTree::reassociate_add_sub(Node* n1, PhaseIdealLoop *phase) {
! if (!n1->is_Add() && !n1->is_Sub() || n1->outcnt() == 0) return NULL;
if (is_invariant(n1)) return NULL;
int inv1_idx = is_invariant_addition(n1, phase);
if (!inv1_idx) return NULL;
// Don't mess with add of constant (igvn moves them to expression tree root.)
if (n1->is_Add() && n1->in(2)->is_Con()) return NULL;
--- 206,216 ----
// (inv2 - x) + inv1 => ( inv1 + inv2) - x
// (inv2 - x) - inv1 => (-inv1 + inv2) - x
// inv1 - (x + inv2) => ( inv1 - inv2) - x
//
Node* IdealLoopTree::reassociate_add_sub(Node* n1, PhaseIdealLoop *phase) {
! if ((!n1->is_Add() && !n1->is_Sub()) || n1->outcnt() == 0) return NULL;
if (is_invariant(n1)) return NULL;
int inv1_idx = is_invariant_addition(n1, phase);
if (!inv1_idx) return NULL;
// Don't mess with add of constant (igvn moves them to expression tree root.)
if (n1->is_Add() && n1->in(2)->is_Con()) return NULL;
*** 727,738 ****
}
// After unroll limit will be adjusted: new_limit = limit-stride.
// Bailout if adjustment overflow.
const TypeInt* limit_type = phase->_igvn.type(limit_n)->is_int();
! if (stride_con > 0 && ((limit_type->_hi - stride_con) >= limit_type->_hi) ||
! stride_con < 0 && ((limit_type->_lo - stride_con) <= limit_type->_lo))
return false; // overflow
// Adjust body_size to determine if we unroll or not
uint body_size = _body.size();
// Key test to unroll loop in CRC32 java code
--- 727,738 ----
}
// After unroll limit will be adjusted: new_limit = limit-stride.
// Bailout if adjustment overflow.
const TypeInt* limit_type = phase->_igvn.type(limit_n)->is_int();
! if ((stride_con > 0 && ((limit_type->_hi - stride_con) >= limit_type->_hi)) ||
! (stride_con < 0 && ((limit_type->_lo - stride_con) <= limit_type->_lo)))
return false; // overflow
// Adjust body_size to determine if we unroll or not
uint body_size = _body.size();
// Key test to unroll loop in CRC32 java code
*** 1411,1421 ****
tty->print("Unroll %d ", loop_head->unrolled_count()*2);
}
loop->dump_head();
}
! if (C->do_vector_loop() && (PrintOpto && VerifyLoopOptimizations || TraceLoopOpts)) {
Arena* arena = Thread::current()->resource_area();
Node_Stack stack(arena, C->live_nodes() >> 2);
Node_List rpo_list;
VectorSet visited(arena);
visited.set(loop_head->_idx);
--- 1411,1421 ----
tty->print("Unroll %d ", loop_head->unrolled_count()*2);
}
loop->dump_head();
}
! if (C->do_vector_loop() && (PrintOpto && (VerifyLoopOptimizations || TraceLoopOpts))) {
Arena* arena = Thread::current()->resource_area();
Node_Stack stack(arena, C->live_nodes() >> 2);
Node_List rpo_list;
VectorSet visited(arena);
visited.set(loop_head->_idx);
*** 1514,1525 ****
assert(has_ctrl(opaq), "should have it");
Node* opaq_ctrl = get_ctrl(opaq);
limit = new Opaque2Node( C, limit );
register_new_node( limit, opaq_ctrl );
}
! if (stride_con > 0 && (java_subtract(limit_type->_lo, stride_con) < limit_type->_lo) ||
! stride_con < 0 && (java_subtract(limit_type->_hi, stride_con) > limit_type->_hi)) {
// No underflow.
new_limit = new SubINode(limit, stride);
} else {
// (limit - stride) may underflow.
// Clamp the adjustment value with MININT or MAXINT:
--- 1514,1525 ----
assert(has_ctrl(opaq), "should have it");
Node* opaq_ctrl = get_ctrl(opaq);
limit = new Opaque2Node( C, limit );
register_new_node( limit, opaq_ctrl );
}
! if ((stride_con > 0 && (java_subtract(limit_type->_lo, stride_con) < limit_type->_lo)) ||
! (stride_con < 0 && (java_subtract(limit_type->_hi, stride_con) > limit_type->_hi))) {
// No underflow.
new_limit = new SubINode(limit, stride);
} else {
// (limit - stride) may underflow.
// Clamp the adjustment value with MININT or MAXINT:
*** 1650,1660 ****
}
loop->record_for_igvn();
#ifndef PRODUCT
! if (C->do_vector_loop() && (PrintOpto && VerifyLoopOptimizations || TraceLoopOpts)) {
tty->print("\nnew loop after unroll\n"); loop->dump_head();
for (uint i = 0; i < loop->_body.size(); i++) {
loop->_body.at(i)->dump();
}
if(C->clone_map().is_debug()) {
--- 1650,1660 ----
}
loop->record_for_igvn();
#ifndef PRODUCT
! if (C->do_vector_loop() && (PrintOpto && (VerifyLoopOptimizations || TraceLoopOpts))) {
tty->print("\nnew loop after unroll\n"); loop->dump_head();
for (uint i = 0; i < loop->_body.size(); i++) {
loop->_body.at(i)->dump();
}
if(C->clone_map().is_debug()) {
< prev index next >