------- Comment #12 from steven at gcc dot gnu dot org 2008-09-21 13:58 ------- tree PRE now *does* handle the partially redundant global variable load. This is the .final_cleanup dump:
;; Function bar (bar) bar () { int prephitmp.13; <bb 2>: prephitmp.13 = i; switch (prephitmp.13) <default: <L1>, case 0: <L0>> <L0>: foo (); prephitmp.13 = i; <L1>: switch (prephitmp.13) <default: <L5>, case 0: <L4>> <L4>: foo (); [tail call] <L5>: return; } But we still miss the jump threading opportunity. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18046