[PATCH] D102698: [InstCombine] Relaxed constraints of uses for exp(X) * exp(Y) -> exp(X + Y) and exp2(X) * exp2(Y) -> exp2(X + Y)

Daniil Seredkin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 24 05:14:57 PDT 2021


vdsered added inline comments.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:3309-3310
+  auto NumOps = I->getNumOperands();
+  return std::any_of(I->op_begin(), I->op_end(),
+                     [](const Use &Op) { return Op.get()->hasOneUse(); }) ||
+         (FirstOp->hasNUses(NumOps) &&
----------------
spatel wrote:
> Use llvm::any_of() to shorten, and implicit convert operand list to Value?
>   return any_of(I.operands(), [](Value *V) { return V->hasOneUse();}) || ...
> 
Fixed.


================
Comment at: llvm/lib/Transforms/Utils/Local.cpp:3312
+         (FirstOp->hasNUses(NumOps) &&
+          llvm::is_splat(llvm::make_range(I->op_begin(), I->op_end())));
+}
----------------
spatel wrote:
> I->operands() ?
Fixed.


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

https://reviews.llvm.org/D102698



More information about the llvm-commits mailing list