Bug 15346 - [tree-ssa] combine two successive divisions
Summary: [tree-ssa] combine two successive divisions
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: tree-optimization (show other bugs)
Version: tree-ssa
: P2 enhancement
Target Milestone: ---
Assignee: Richard Biener
URL:
Keywords: missed-optimization
Depends on: 15459
Blocks:
  Show dependency treegraph
 
Reported: 2004-05-09 19:23 UTC by Kazu Hirata
Modified: 2014-12-01 13:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2008-04-29 10:05:04


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kazu Hirata 2004-05-09 19:23:00 UTC
int
foo (int a)
{
  int tem = a / 5;
  return tem / 3;
}

Note that if the expression is written without tem like a / 5 / 3,
then fold() can generate a / 15.
Comment 1 Andrew Pinski 2004-05-09 19:24:42 UTC
Confirmed.
Comment 2 Andrew Pinski 2004-05-17 01:53:36 UTC
Will be fixed when PR 15459 is fixed (I have a slight patch for PR 15459 which I can give 
to you if you want to try it).
Comment 3 Andrew Pinski 2004-05-26 14:32:16 UTC
Mine.
Comment 4 Andrew Pinski 2004-06-21 05:13:59 UTC
Will be submitting the tree combiner tonight.
Comment 5 Andrew Pinski 2005-07-12 21:27:38 UTC
It might be a while for me to rewrite the tree combiner so unassigning for now.
Comment 6 Richard Biener 2008-04-29 10:05:04 UTC
tree-ssa-reassoc can/should be extended to do this.
Comment 7 Richard Biener 2014-12-01 13:13:43 UTC
Fixed.
Comment 8 Richard Biener 2014-12-01 13:13:59 UTC
Author: rguenth
Date: Mon Dec  1 13:13:28 2014
New Revision: 218211

URL: https://gcc.gnu.org/viewcvs?rev=218211&root=gcc&view=rev
Log:
2014-12-01  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/15346
	* Makefile.in (gimple-match.o-warn): Remove -Wno-unused-parameter,
	add -Wno-unused-but-set-variable.
	* match.pd: Combine two successive divisions.

	* gcc.dg/tree-ssa/forwprop-32.c: New testcase.

Added:
    trunk/gcc/testsuite/gcc.dg/tree-ssa/forwprop-32.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/match.pd
    trunk/gcc/testsuite/ChangeLog