[PATCH] D85593: [InstCombine] ~(~X + Y) -> X - Y

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 06:13:33 PDT 2020


spatel added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/not-add.ll:94
+; CHECK-NEXT:    [[A:%.*]] = add i8 [[NOTX]], [[Y:%.*]]
+; CHECK-NEXT:    call void @use(i8 [[A]])
+; CHECK-NEXT:    [[NOTA:%.*]] = xor i8 [[A]], -1
----------------
xbolva00 wrote:
> @lebedev.ri
> 
> not seems better than sub x, y so oneuse check is ok (?)
It's true that in some cases (for example, expensive FP ops), we have leaned toward a more restrictive one-use check.

In this case, however, I do not think that the relative analysis improvement of an xor vs. sub should limit the transform. 

Reducing the number of operand uses and dependency chain could allow follow-on improvements.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D85593/new/

https://reviews.llvm.org/D85593



More information about the llvm-commits mailing list