[PATCH] D136623: [InstCombine] enable more factorization in SimplifyUsingDistributiveLaws

Allen zhong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 27 20:33:17 PDT 2022


Allen marked 5 inline comments as done.
Allen added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:759
+  // term.
+  if (Op0) {
+    if (Value *Ident = getIdentityValue(LHSOpcode, RHS))
----------------
spatel wrote:
> Make formatting changes independently of this patch or just leave it unchanged.
Thansk for your suggestion, addressed https://reviews.llvm.org/D136912


================
Comment at: llvm/test/Transforms/InstCombine/add4.ll:157
+
+; (x + y) - (x * C) --> (1 + C) * x + y
+define i32 @mul_add_common_factor_commute2(i32 %x, i32 %y) {
----------------
spatel wrote:
> (x + y) + (x * 4) --> (x * 5) + y
> 
> Is this converted to `shl` first?
Instcombine is executed many times, and we have a chance to match the **mul ** version.


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

https://reviews.llvm.org/D136623



More information about the llvm-commits mailing list