[PATCH] Added instruction combine to transform few more negative values addition to subtraction (Part 3)

Dinesh Dwivedi dinesh.d at samsung.com
Thu Jun 26 00:22:21 PDT 2014


> I have a more high-level question. Why are these logics in checkForNegativeOperand instead of visitXor? Aren't transformations such as
>  XOR(AND(Z, ~C), (~C + 1)) => NEG(OR(Z, C))
> beneficial even the XOR is not the RHS of an ADD?

NEG(X) gets converted to XOR.
  NEG(X) = XOR(x, -1) + 1

So it is not useful to transform XOR(..) to NEG(..) and it will loop infinitely.

http://reviews.llvm.org/D4210






More information about the llvm-commits mailing list