[PATCH] D109151: [InstCombine] Convert xor (ashr X, BW-1), C -> select(X >=s 0, C, ~C)

Roman Lebedev via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 8 03:17:05 PDT 2021


lebedev.ri added inline comments.


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:3434
+    const APInt *CA;
+    if (match(Op0, m_TruncOrSelf(m_OneUse(m_AShr(m_Value(X), m_APInt(CA))))) &&
+        *CA == X->getType()->getScalarSizeInBits() - 1 &&
----------------
I'm not sure this one-use check does what you want it to do when there's `trunc`


================
Comment at: llvm/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp:3434
+    const APInt *CA;
+    if (match(Op0, m_TruncOrSelf(m_OneUse(m_AShr(m_Value(X), m_APInt(CA))))) &&
+        *CA == X->getType()->getScalarSizeInBits() - 1 &&
----------------
lebedev.ri wrote:
> I'm not sure this one-use check does what you want it to do when there's `trunc`
Should this use `m_APIntAllowUndef`?


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

https://reviews.llvm.org/D109151



More information about the llvm-commits mailing list