Hi, compiling the attached testcase (reduced from tree.c) with -O2 leads to vrp folding: if (D.2762_2 == 6) goto <bb 3>; else goto <bb 9>;
<bb 3>: D.2766_5 = (int) D.2762_2; D.2767_6 = tree_code_type[D.2766_5]; into D.2762_2 = type_1(D)->base.code; if (D.2762_2 == 6) goto <bb 3>; else goto <bb 9>; <bb 3>: D.2766_5 = 6; D.2767_6 = tree_code_type[6]; this is good transform, however tree_code_type is constant initialized array and we miss possibility to fold it into constant until expansion triggering code in expr.c I would like to retire. We can fold tree_code_type[6], so apparently just no one calls fold_gimple_stmt on it? -- Summary: VRP misses oppurtunity for statement folding. Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hubicka at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45522