[PATCH] D61307: [InstCombine] Add new combine to sub folding

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 1 12:47:29 PDT 2019


lebedev.ri added a comment.

Right, no commit rights i guess?
This looks good to me. I think this needs one more test.



================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp:1531-1532
 
-  // If this is a 'B = x-(-A)', change to B = x+A.
   Value *Op0 = I.getOperand(0), *Op1 = I.getOperand(1);
+  // (X | Y) - Y --> (X | Y) ^ Y
+  // (Y | X) - Y --> (Y | X) ^ Y
----------------
This needs a newline


================
Comment at: llvm/test/Transforms/InstCombine/sub.ll:1287
+  %C = or i32 %A, %B
+  %D = sub i32 %C, %B
+  ret i32 %D
----------------
This needs a negative test, with swapped order in `sub`.


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

https://reviews.llvm.org/D61307





More information about the llvm-commits mailing list