[PATCH] D152568: [InstCombine] Transform `(binop1 (binop2 (lshift X,Amt),Mask),(lshift Y,Amt))`

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 10:31:12 PDT 2023


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:811-818
+    if (I.getOpcode() == Instruction::And) {
+      // Pass
+    }
+    // For all other possible transfers we need complete distributable
+    // binop/shift (anything but `add` + `lshr`).
+    else if (!IsCompletelyDistributable(I.getOpcode(), BinOpc, ShOpc)) {
+      return nullptr;
----------------
nikic wrote:
> 
Ignore this bit, it's not going to work because it's followed by `else if` ... in that case, see the note below about just extracting these checks into a bool-returning function, so that you can use early returns.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152568



More information about the llvm-commits mailing list