author | vdeshpande |
Fri, 26 Aug 2016 12:20:09 -0700 | |
changeset 41362 | e09e871860a7 |
parent 40059 | c2304140ed64 |
permissions | -rw-r--r-- |
21578
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
1 |
/* |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
2 |
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
4 |
* |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
8 |
* |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
13 |
* accompanied this code). |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
14 |
* |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
18 |
* |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
21 |
* questions. |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
22 |
*/ |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
23 |
|
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
24 |
/* |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
25 |
* @test |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
26 |
* @bug 8028207 |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
27 |
* @summary Verify that GVN doesn't mess up the two addExacts |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
28 |
* |
40059 | 29 |
* @run main compiler.intrinsics.mathexact.GVNTest |
21578
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
30 |
*/ |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
31 |
|
40059 | 32 |
package compiler.intrinsics.mathexact; |
33 |
||
21578
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
34 |
public class GVNTest { |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
35 |
public static int result = 0; |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
36 |
public static int value = 93; |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
37 |
public static void main(String[] args) { |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
38 |
for (int i = 0; i < 50000; ++i) { |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
39 |
result = runTest(value + i); |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
40 |
result = runTest(value + i); |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
41 |
result = runTest(value + i); |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
42 |
result = runTest(value + i); |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
43 |
result = runTest(value + i); |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
44 |
} |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
45 |
} |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
46 |
|
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
47 |
public static int runTest(int value) { |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
48 |
int v = value + value; |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
49 |
int sum = 0; |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
50 |
if (v < 4032) { |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
51 |
for (int i = 0; i < 1023; ++i) { |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
52 |
sum += Math.addExact(value, value); |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
53 |
} |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
54 |
} else { |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
55 |
for (int i = 0; i < 321; ++i) { |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
56 |
sum += Math.addExact(value, value); |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
57 |
} |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
58 |
} |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
59 |
return sum + v; |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
60 |
} |
d380e7e6f805
8028207: assert(_outcnt==1) failed: not unique in compile.cpp
rbackman
parents:
diff
changeset
|
61 |
} |