This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/31966] [4.1/4.2/4.3 Regression] Miscompiles valid code with -ftree-vectorize
- From: "ubizjak at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Jul 2007 15:46:41 -0000
- Subject: [Bug tree-optimization/31966] [4.1/4.2/4.3 Regression] Miscompiles valid code with -ftree-vectorize
- References: <bug-31966-6477@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #7 from ubizjak at gmail dot com 2007-07-01 15:46 -------
Well, the problem is, that we "forgot" to take into account false branch from
bb4 to bb6. In notation form the Comment #6, this branch has the condition !C4,
so the total condition for branch from bb4 leading to bb6 would be: !C3 && !C4.
The conditions for both branches leading to phi node are then:
left: (C3 || C4) && 1 -----> C3 || C4
right: !C3 && !C4 ---------> !(C3 || C4)
With above correction, phi
# quotient_3 = PHI <quotient_20(4), quotient_22(5)>
would be substituted with:
quotient_3 = !(C3 || C4) ? quotient_20 : quotient_22;
or:
quotient_3 = (C3 || C4) ? quotient_22 : quotient_20;
which just happens to be the correct condition.
QED.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31966