In some cases Clang does not perform merging of instructions AND and TST (aka ANDS xzr), like
Example:
tst x2, x1 and x3, x2, x1
to:
ands x3, x2, x1
This patch add such merging during instruction selection:
when AND is replaced with ANDS instruction in LowerSELECT_CC,
all users of AND also should be changed for using this ANDS instruction
Short discussion on mailing list
http://llvm.1065342.n5.nabble.com/llvm-dev-ARM-Peephole-optimization-instructions-tst-add-tp133109.html
nit. the && should be on the line above