Fix the rewrite rule that optimizes packing of string literals

The description is in the commit message.