This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/18178] Missed opportunity for removing bounds checking
- From: "steven at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 8 Feb 2005 21:07:04 -0000
- Subject: [Bug tree-optimization/18178] Missed opportunity for removing bounds checking
- References: <20041027140944.18178.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From steven at gcc dot gnu dot org 2005-02-08 21:07 -------
We have this hunk in the .vrp dump:
# BLOCK 1
# PRED: 4 (true,exec)
<L0>:;
iD.1901_30 = iD.1901_1;
D.1909_31 = D.1909_4;
i.0D.1911_5 = (unsigned intD.6) iD.1901_30;
D.1909_6 = D.1909_31;
D.1912_7 = (unsigned intD.6) D.1909_6;
if (i.0D.1911_5 >= D.1912_7) goto <L1>; else goto <L2>;
# SUCC: 2 (true,exec) 3 (false,exec)
# BLOCK 2
# PRED: 1 (true,exec)
<L1>:;
# TMT.3D.1926_25 = V_MAY_DEF <TMT.3D.1926_20>;
# TMT.2D.1925_26 = V_MAY_DEF <TMT.2D.1925_19>;
# VUSE <_ZTIiD.1905_14>;
D.1904_16 = __cxa_allocate_exception (4);
D.1914_18 = (intD.2 *) D.1904_16;
# TMT.3D.1926_27 = V_MAY_DEF <TMT.3D.1926_25>;
*D.1914_18 = 5;
D.1914_2 = D.1914_18;
# VUSE <_ZTIiD.1905_14>;
# VUSE <TMT.3D.1926_27>;
# VUSE <TMT.2D.1925_26>;
__cxa_throw (D.1904_16, &_ZTIiD.1905, 0B);
# SUCC:
# BLOCK 3
# PRED: 1 (false,exec)
<L2>:;
and:
i.0_5: VARYING
D.1909_6: [-2147483648, i_30 - 1]
D.1912_7: VARYING
If WORK_WORK_WORK is defined, we have:
# BLOCK 1
# PRED: 4 (true,exec)
<L0>:;
iD.1901_30 = iD.1901_1;
D.1909_31 = D.1909_4;
D.1909_5 = D.1909_31;
if (iD.1901_30 >= D.1909_5) goto <L1>; else goto <L2>;
# SUCC: 2 (true,exec) 3 (false,exec)
# BLOCK 2
# PRED: 1 (true,exec)
<L1>:;
# TMT.2D.1925_24 = V_MAY_DEF <TMT.2D.1925_19>;
# TMT.1D.1924_25 = V_MAY_DEF <TMT.1D.1924_18>;
# VUSE <_ZTIiD.1905_13>;
D.1904_15 = __cxa_allocate_exception (4);
D.1912_17 = (intD.2 *) D.1904_15;
# TMT.2D.1925_26 = V_MAY_DEF <TMT.2D.1925_24>;
*D.1912_17 = 5;
D.1912_2 = D.1912_17;
# VUSE <_ZTIiD.1905_13>;
# VUSE <TMT.2D.1925_26>;
# VUSE <TMT.1D.1924_25>;
__cxa_throw (D.1904_15, &_ZTIiD.1905, 0B);
# SUCC:
# BLOCK 3
# PRED: 1 (false,exec)
<L2>:;
and
i_30: [0, D.1909_4 - 1]
D.1909_5: [0, i_30 - 1]
Note that even though (i_30 >= D.1909_5), VRP does not clean this up.
The exception stays there until DOM1.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18178