In theory, the two renderings may produce different results, if you pass one or more objects to qsprintf(...) and then modify the objects after the qsprintf(...) call but before the query is executed. This would likely be very, very surprising.
To avoid this, immediately render the string and store the flat string value, not the arguments.
This is technically also a performance change (it reduces calls to xsprintf_query() by about 50%, since we don't rebuild the string twice) but now justfiable purely as a correctness/simplicity change.
(I'm going to try to make a followup performance change where we just render the masked string and use it for both values if the masked and unmasked strings are identical, but I'll justify that with profiling.)