https://gcc.gnu.org/bugzilla/show_bug.cgi?id=18940
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|--- |13.0 Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> --- Fixed in GCC 13. DOM3 now optimizes it: Optimizing statement _17 = D1360_10 > 0; LKUP STMT _17 = D1360_10 gt_expr 0 2>>> STMT _17 = D1360_10 gt_expr 0 LKUP STMT D1360_10 le_expr 1 Optimizing statement _16 = (unsigned int) D1360_10; LKUP STMT _16 = nop_expr D1360_10 2>>> STMT _16 = nop_expr D1360_10 Optimizing statement niters.3_18 = _17 ? _16 : 1; Replaced '_17' with constant '1' Registering value_relation (_16 pe32 D1360_10) (bb3) at _16 = (unsigned int) D1360_10; Applying pattern match.pd:4437, gimple-match.cc:176249 gimple_simplified to niters.3_18 = _16; Folded to: niters.3_18 = _16;