This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug tree-optimization/55629] New: Missed value numbering to a constant
- From: "steven at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sun, 09 Dec 2012 15:54:29 +0000
- Subject: [Bug tree-optimization/55629] New: Missed value numbering to a constant
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55629
Bug #: 55629
Summary: Missed value numbering to a constant
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: tree-optimization
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: steven@gcc.gnu.org
Consider a classic example of non-distributivity of constant propagation:
int foo (int);
int foo (int c) {
int a, b;
if (c) { a = 3; b = 2; }
else { a = 2; b = 3; }
return a + b;
}
Value numbering should be able to determine that a+b=5. GCC successfully
optimizes the test case to just "return 5" with -ftree-pre, but with "only"
-ftree-fre (-O1) the equivalence is not noticed.