equal
deleted
inserted
replaced
1 /* |
1 /* |
2 * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1998, 2017, 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. |
383 PhiNode *phi = xphi->as_Phi(); |
383 PhiNode *phi = xphi->as_Phi(); |
384 |
384 |
385 // Phi must be of loop header; backedge must wrap to increment |
385 // Phi must be of loop header; backedge must wrap to increment |
386 if (phi->region() != x) |
386 if (phi->region() != x) |
387 return false; |
387 return false; |
388 if (trunc1 == NULL && phi->in(LoopNode::LoopBackControl) != incr || |
388 if ((trunc1 == NULL && phi->in(LoopNode::LoopBackControl) != incr) || |
389 trunc1 != NULL && phi->in(LoopNode::LoopBackControl) != trunc1) { |
389 (trunc1 != NULL && phi->in(LoopNode::LoopBackControl) != trunc1)) { |
390 return false; |
390 return false; |
391 } |
391 } |
392 Node *init_trip = phi->in(LoopNode::EntryControl); |
392 Node *init_trip = phi->in(LoopNode::EntryControl); |
393 |
393 |
394 // If iv trunc type is smaller than int, check for possible wrap. |
394 // If iv trunc type is smaller than int, check for possible wrap. |
428 |
428 |
429 // If the condition is inverted and we will be rolling |
429 // If the condition is inverted and we will be rolling |
430 // through MININT to MAXINT, then bail out. |
430 // through MININT to MAXINT, then bail out. |
431 if (bt == BoolTest::eq || // Bail out, but this loop trips at most twice! |
431 if (bt == BoolTest::eq || // Bail out, but this loop trips at most twice! |
432 // Odd stride |
432 // Odd stride |
433 bt == BoolTest::ne && stride_con != 1 && stride_con != -1 || |
433 (bt == BoolTest::ne && stride_con != 1 && stride_con != -1) || |
434 // Count down loop rolls through MAXINT |
434 // Count down loop rolls through MAXINT |
435 (bt == BoolTest::le || bt == BoolTest::lt) && stride_con < 0 || |
435 ((bt == BoolTest::le || bt == BoolTest::lt) && stride_con < 0) || |
436 // Count up loop rolls through MININT |
436 // Count up loop rolls through MININT |
437 (bt == BoolTest::ge || bt == BoolTest::gt) && stride_con > 0) { |
437 ((bt == BoolTest::ge || bt == BoolTest::gt) && stride_con > 0)) { |
438 return false; // Bail out |
438 return false; // Bail out |
439 } |
439 } |
440 |
440 |
441 const TypeInt* init_t = gvn->type(init_trip)->is_int(); |
441 const TypeInt* init_t = gvn->type(init_trip)->is_int(); |
442 const TypeInt* limit_t = gvn->type(limit)->is_int(); |
442 const TypeInt* limit_t = gvn->type(limit)->is_int(); |