[PATCH] D153963: [InstCombine] Fold binop of select and cast of select condition

Noah Goldstein via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 11 09:57:39 PDT 2023


goldstein.w.n added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstructionCombining.cpp:893
+  // operating on a i1.
+  if (!(match(RHS, m_ZExtOrSExt(m_Value(A))) &&
+        A->getType()->getScalarSizeInBits() == 1))
----------------
Is there a reason RHS must be the ext and LHS must be the select?


================
Comment at: llvm/test/Transforms/InstCombine/binop-select-cast-of-select-cond.ll:157
+  %vec1 = insertelement <2 x i64> %vec0, i64 %ext, i32 1
+  %add = add <2 x i64> %sel, %vec1
+  ret <2 x i64> %add
----------------
Can you add the following tests:

1) where select is on the RHS of the binop.
2) Where the select is multi-use
3) Where the select has two non-const sides.


================
Comment at: llvm/test/Transforms/InstCombine/binop-select-cast-of-select-cond.ll:197
+  ret <2 x i64> %add
+}
----------------
antoniofrighetto wrote:
> goldstein.w.n wrote:
> > Can you split the tests to a seperate commit so we can see the diff generated by this patch?
> Do you mean to open a different patch for the tests (or land them directly)?
Open a different patch.


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

https://reviews.llvm.org/D153963



More information about the llvm-commits mailing list