https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115259
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization --- Comment #14 from Andrew Pinski <pinskia at gcc dot gnu.org> --- One thing I did note that cselim (which runs before sink1) on x86_64 (and aarch64) was able to transform: ``` extent[n_11] = _9; if (_9 < 0) goto <bb 4>; [41.00%] else goto <bb 5>; [59.00%] <bb 4> [local count: 391808389]: extent[n_11] = 0; <bb 5> [local count: 955630224]: ``` into: ``` extent[n_11] = _9; if (_9 < 0) goto <bb 5>; [41.00%] else goto <bb 4>; [59.00%] <bb 4> [local count: 563821836]: cstore_25 = MEM <index_type[15]> [(void *)&extent][n_11]; <bb 5> [local count: 955630224]: # cstore_26 = PHI <cstore_25(4), 0(3)> MEM <index_type[15]> [(void *)&extent][n_11] = cstore_26; ``` But I didn't look into why it didn't do that for gcn though. Being able to do that, then sink would not do anything and you will not get the MASKED_STORE mess that is currently being produced either and would be better code generation in the first place.