1 /*
2 * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
655 return cmp2_t;
656 case BoolTest::lt:
657 lo = TypeInt::INT->_lo;
658 if (hi - 1 < hi) {
659 hi = hi - 1;
660 }
661 break;
662 case BoolTest::le:
663 lo = TypeInt::INT->_lo;
664 break;
665 case BoolTest::gt:
666 if (lo + 1 > lo) {
667 lo = lo + 1;
668 }
669 hi = TypeInt::INT->_hi;
670 break;
671 case BoolTest::ge:
672 // lo unchanged
673 hi = TypeInt::INT->_hi;
674 break;
675 }
676 const TypeInt* rtn_t = TypeInt::make(lo, hi, cmp2_t->_widen);
677 return rtn_t;
678 }
679 }
680 }
681 }
682 }
683 return NULL;
684 }
685
686 //------------------------------fold_compares----------------------------
687 // See if a pair of CmpIs can be converted into a CmpU. In some cases
688 // the direction of this if is determined by the preceding if so it
689 // can be eliminate entirely.
690 //
691 // Given an if testing (CmpI n v) check for an immediately control
692 // dependent if that is testing (CmpI n v2) and has one projection
693 // leading to this if and the other projection leading to a region
694 // that merges one of this ifs control projections.
|
1 /*
2 * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
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
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
655 return cmp2_t;
656 case BoolTest::lt:
657 lo = TypeInt::INT->_lo;
658 if (hi - 1 < hi) {
659 hi = hi - 1;
660 }
661 break;
662 case BoolTest::le:
663 lo = TypeInt::INT->_lo;
664 break;
665 case BoolTest::gt:
666 if (lo + 1 > lo) {
667 lo = lo + 1;
668 }
669 hi = TypeInt::INT->_hi;
670 break;
671 case BoolTest::ge:
672 // lo unchanged
673 hi = TypeInt::INT->_hi;
674 break;
675 default:
676 break;
677 }
678 const TypeInt* rtn_t = TypeInt::make(lo, hi, cmp2_t->_widen);
679 return rtn_t;
680 }
681 }
682 }
683 }
684 }
685 return NULL;
686 }
687
688 //------------------------------fold_compares----------------------------
689 // See if a pair of CmpIs can be converted into a CmpU. In some cases
690 // the direction of this if is determined by the preceding if so it
691 // can be eliminate entirely.
692 //
693 // Given an if testing (CmpI n v) check for an immediately control
694 // dependent if that is testing (CmpI n v2) and has one projection
695 // leading to this if and the other projection leading to a region
696 // that merges one of this ifs control projections.
|