The -i option to sed takes an option argument, a filename suffix to use for the backup file when editing the input file in place. With GNU sed, this option argument is optional, but will obviously be used if supplied.
 Using -ir tells sedsed that the filename of the backup file should have the original name of the input file suffixed by the character r.  Since -r is now not used, the back reference in the replacement part of the expression is no longer recognised as a valid, since there is no \( ... \) group in the pattern (which is how you capture a part of a pattern with a basic regular expression).
 In conclusion, sed -ri is not the same as sed -ir.
 
                