[PATCH] D152088: [InstCombine] add nsw on InstCombineAdd ~X + C --> (C-1) - X

Kohei Asano via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 5 03:53:23 PDT 2023


khei4 added a comment.

> This looks more complicated than necessary, just this should be enough: https://alive2.llvm.org/ce/z/ZWmZLv

Thanks! Seems cool! I'll put it on description :)



================
Comment at: llvm/test/Transforms/InstCombine/add.ll:420
   %B = xor <2 x i8> %A, <i8 -1, i8 -1>
-  %C = add nsw <2 x i8> %B, <i8 -127, i8 -126>
+  %C = add nsw <2 x i8> %B, <i8 -124, i8 -125>
   ret <2 x i8> %C
----------------
nikic wrote:
> You've adjusted the constants here so it now folds, which doesn't match the TODO comment. Not sure what the intention for this test was.
Sorry, I tweaked it not to attach nsw, I'll rebase.


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

https://reviews.llvm.org/D152088



More information about the llvm-commits mailing list