This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/47271] [4.6 Regression] if-conversion removes a test (if), the function generates invalid outputs
- From: "spop at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 24 Jan 2011 18:34:41 +0000
- Subject: [Bug tree-optimization/47271] [4.6 Regression] if-conversion removes a test (if), the function generates invalid outputs
- Auto-submitted: auto-generated
- References: <bug-47271-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47271
--- Comment #8 from Sebastian Pop <spop at gcc dot gnu.org> 2011-01-24 18:34:38 UTC ---
The translation in predicate_all_scalar_phis assumes that the incoming
edges OR up to true: it translates a phi node
x = phi (y, z)
into
x = a ? y : z;
In the testcase of this PR, the conditions of the two edges is not
ORing up to true: we have something like this:
x = a ? y : x;
x = (!a and b) ? z : x;
this is because we have a CFG containing diamond shape, and the write
into x does not happen at every execution of the loop: (a and !b)
should not modify the value of x.
A possible solution is to filter out these cases in predicate_bbs.