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

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 9 07:08:41 PDT 2020


nikic 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:
> spatel wrote:
> > 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.
> Ok, thanks. Will drop it.
Is this transform even legal without the one-use restriction? It *increases* the number of uses, as such it's not obvious that it the transform without one-use restriction is undef-safe.


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

https://reviews.llvm.org/D85593



More information about the llvm-commits mailing list