src/share/vm/opto/loopTransform.cpp

changeset 9806
758c07667682
parent 9756
2be326848943
parent 9772
eee5798e1b28
child 10015
eb7ce841ccec
equal deleted inserted replaced
9762:c97db0855565 9806:758c07667682
1 /* 1 /*
2 * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
2229 Node *exact_limit = phase->exact_limit(this); 2229 Node *exact_limit = phase->exact_limit(this);
2230 if (exact_limit != cl->limit()) { 2230 if (exact_limit != cl->limit()) {
2231 // We also need to replace the original limit to collapse loop exit. 2231 // We also need to replace the original limit to collapse loop exit.
2232 Node* cmp = cl->loopexit()->cmp_node(); 2232 Node* cmp = cl->loopexit()->cmp_node();
2233 assert(cl->limit() == cmp->in(2), "sanity"); 2233 assert(cl->limit() == cmp->in(2), "sanity");
2234 // Duplicate cmp node if it has other users
2235 if (cmp->outcnt() > 1) {
2236 cmp = cmp->clone();
2237 cmp = phase->_igvn.register_new_node_with_optimizer(cmp);
2238 BoolNode *bol = cl->loopexit()->in(CountedLoopEndNode::TestValue)->as_Bool();
2239 phase->_igvn.replace_input_of(bol, 1, cmp); // put bol on worklist
2240 }
2234 phase->_igvn._worklist.push(cmp->in(2)); // put limit on worklist 2241 phase->_igvn._worklist.push(cmp->in(2)); // put limit on worklist
2235 phase->_igvn.replace_input_of(cmp, 2, exact_limit); // put cmp on worklist 2242 phase->_igvn.replace_input_of(cmp, 2, exact_limit); // put cmp on worklist
2236 } 2243 }
2237 // Note: the final value after increment should not overflow since 2244 // Note: the final value after increment should not overflow since
2238 // counted loop has limit check predicate. 2245 // counted loop has limit check predicate.

mercurial