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: [email protected]
ReportedBy: [email protected]
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.