This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/18576] [3.4/4.0 Regression] missing jump threading because of type changes
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Dec 2004 17:42:01 -0000
- Subject: [Bug tree-optimization/18576] [3.4/4.0 Regression] missing jump threading because of type changes
- References: <20041120062915.18576.pinskia@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From kazu at cs dot umass dot edu 2004-12-12 17:42 -------
Another (possibly expensive) approach would be to "ignore" statements whose
results are used only in the basic block we are threading through.
Consider:
# iftmp.0_1 = PHI <1(2), 0(3), 0(1)>;
<L4>:;
D.1171_13 = (unsigned char) iftmp.0_1;
D.1160_14 = (int) D.1171_13;
D.1145_16 = (unsigned char) D.1160_14;
if (D.1145_16 != 0) goto <L8>; else goto <L14>;
Note that the LHS of all MODIFY_EXPRs are used only in this basic block.
So if we get to COND_EXPR and find out that COND_EXPR_COND is a constant
(due to temporary propagation), then we can safely duplicate this basic block
and thread an incoming edge (without causing code bloat).
All the duplicate copies of MODIFY_EXPRs will be removed as dead code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18576