The pattern may look more obviously like a sext if written as:
define i32 @g(i16 %x) {
  %zext = zext i16 %x to i32
  %xor = xor i32 %zext, 32768
  %add = add i32 %xor, -32768
  ret i32 %add
}We already have that fold in visitAdd().
And that probably gives away how I got here: I was testing if we had any missing folds if we make D22271 more liberal about pulling logic ops ahead of zexts.
Why m_OneUse ?