[PATCH] D132412: [InstCombine] ease use constraint in tryFactorization()

chenglin.bi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 24 02:01:13 PDT 2022


bcl5980 added inline comments.


================
Comment at: llvm/test/Transforms/InstCombine/sub.ll:2007
+; x * y - x --> (y - 1) * x
+; TODO: The mul could retain nsw.
+
----------------
Allen wrote:
> bcl5980 wrote:
> > Allen wrote:
> > > sorry for the naive question, does the nsw of mul implies that of add? As you just say the mul could retain nsw. 
> > https://alive2.llvm.org/ce/z/WjpNoD
> > add pattern can't retain nsw. overflow comes from -1 * INT_MIN
> Thanks @bcl5980,  as your case showed, the mul pattern also can't retain nsw ? 
Yeah, these two patterns are the only two cases we can keep mul flag. All add/sub flags will be lost.
https://alive2.llvm.org/ce/z/HDyrwb


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

https://reviews.llvm.org/D132412



More information about the llvm-commits mailing list