[PATCH] D33585: [InstSimplify] Use commutable matchers to shorten some code
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 26 12:04:17 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL304022: [InstSimplify] Use commutable matchers to shorten some code (authored by ctopper).
Changed prior to commit:
https://reviews.llvm.org/D33585?vs=100434&id=100443#toc
Repository:
rL LLVM
https://reviews.llvm.org/D33585
Files:
llvm/trunk/lib/Analysis/InstructionSimplify.cpp
Index: llvm/trunk/lib/Analysis/InstructionSimplify.cpp
===================================================================
--- llvm/trunk/lib/Analysis/InstructionSimplify.cpp
+++ llvm/trunk/lib/Analysis/InstructionSimplify.cpp
@@ -1930,26 +1930,18 @@
// If we have: ((V + N) & C1) | (V & C2)
// .. and C2 = ~C1 and C2 is 0+1+ and (N & C2) == 0
// replace with V+N.
- Value *V1, *V2;
+ Value *N;
if (C2->isMask() && // C2 == 0+1+
- match(A, m_Add(m_Value(V1), m_Value(V2)))) {
+ match(A, m_c_Add(m_Specific(B), m_Value(N)))) {
// Add commutes, try both ways.
- if (V1 == B &&
- MaskedValueIsZero(V2, *C2, Q.DL, 0, Q.AC, Q.CxtI, Q.DT))
- return A;
- if (V2 == B &&
- MaskedValueIsZero(V1, *C2, Q.DL, 0, Q.AC, Q.CxtI, Q.DT))
+ if (MaskedValueIsZero(N, *C2, Q.DL, 0, Q.AC, Q.CxtI, Q.DT))
return A;
}
// Or commutes, try both ways.
if (C1->isMask() &&
- match(B, m_Add(m_Value(V1), m_Value(V2)))) {
+ match(B, m_c_Add(m_Specific(A), m_Value(N)))) {
// Add commutes, try both ways.
- if (V1 == A &&
- MaskedValueIsZero(V2, *C1, Q.DL, 0, Q.AC, Q.CxtI, Q.DT))
- return B;
- if (V2 == A &&
- MaskedValueIsZero(V1, *C1, Q.DL, 0, Q.AC, Q.CxtI, Q.DT))
+ if (MaskedValueIsZero(N, *C1, Q.DL, 0, Q.AC, Q.CxtI, Q.DT))
return B;
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D33585.100443.patch
Type: text/x-patch
Size: 1467 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170526/eae5f272/attachment.bin>
More information about the llvm-commits
mailing list