[llvm] [InstCombine] Improve handling of `not` and free inversion. (PR #66787)

via llvm-commits llvm-commits at lists.llvm.org
Sat Nov 18 09:41:38 PST 2023


================
@@ -4410,6 +4410,11 @@ Instruction *InstCombinerImpl::foldNot(BinaryOperator &I) {
   if (Instruction *NewXor = foldNotXor(I, Builder))
     return NewXor;
 
+  // TODO: Could handle multi-use better by checking if all uses of NotOp (other
+  // than I) can be inverted.
+  if (Value *R = getFreeInverted(NotOp, NotOp->hasOneUse(), &Builder))
+    return replaceInstUsesWith(I, R);
----------------
goldsteinn wrote:

Was actually just operand order changes. Dropping `sinkNotIntoXor`.

https://github.com/llvm/llvm-project/pull/66787


More information about the llvm-commits mailing list