[PATCH] D22477: [InstCombine] fold add(zext(xor X, C), C) --> sext X when C is INT_MIN in the source type

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 18 14:51:08 PDT 2016


spatel added inline comments.

================
Comment at: lib/Transforms/InstCombine/InstCombineAddSub.cpp:1054
@@ +1053,3 @@
+    const APInt *C;
+    if (match(LHS, m_OneUse(m_ZExt(m_OneUse(m_Xor(m_Value(X), m_APInt(C)))))) &&
+        C->isMinSignedValue() &&
----------------
majnemer wrote:
> Why `m_OneUse` ?
I was being conservative, but given that we'd at least shorten the dependency chain for this result regardless of other uses of the zext/xor, we don't need those checks. 

I can remove the m_OneUse and add some more tests to this patch, or if you prefer, I'll add a TODO and follow-up patch.


https://reviews.llvm.org/D22477





More information about the llvm-commits mailing list