struct loop { int depth; struct loop **pred; }; static __inline__ unsigned char flow_loop_nested_p (const struct loop *outer, const struct loop *loop) { return (loop->depth > outer->depth && loop->pred[outer->depth] == outer); }
unsigned char flow_bb_inside_loop_p (const struct loop *loop, const struct loop *source_loop) { return loop == source_loop || flow_loop_nested_p (loop, source_loop); } In .64.final_cleanup: <L2>:; iftmp.0 = 1; goto <bb 5> (<L14>); <L4>:; iftmp.0 = 0; <L14>:; if ((unsigned char) (int) (unsigned char) iftmp.0 != 0) goto <L8>; else goto <L7>; See miss this jump threading (in fact we miss it on the RTL level also). We do get better code already on the tree-cleanup-branch but that is because of my rewrite of PHI-OPT for that branch we get: <L12>:; iftmp.0 = 0; goto <bb 5> (<L4>); <L1>:; iftmp.0 = (int) !(loop != *(source_loop->pred + (struct loop * *) ((unsigned int) D.1160 * 4))); <L4>:; iftmp.1 = (int) ((unsigned char) (int) (unsigned char) iftmp.0 != 0); -- Summary: missing jump threading because of type changes Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pinskia at gcc dot gnu dot org CC: gcc-bugs at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18576