Swap remaining unsafe and chaperone-unsafe operation in the TR optimizer.

Fixes the fix in aba046a92d42.