XINST_CREATE_add with 2 registers produces an unencodable instruction on x86
This code:
XINST_CREATE_add(drcontext, opnd_create_reg(reg_val), opnd_create_reg(reg_ptr));
Produces an encoding error. It's because it tries to create a LEA base-disp with an index register but a 0 scale which is not allowed.
The same bug exists in XINST_CREATE_add_2src
on x86.