aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ValueTracking.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Analysis/ValueTracking.cpp')
-rw-r--r--llvm/lib/Analysis/ValueTracking.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/ValueTracking.cpp b/llvm/lib/Analysis/ValueTracking.cpp
index 9a61b36..4b246c0 100644
--- a/llvm/lib/Analysis/ValueTracking.cpp
+++ b/llvm/lib/Analysis/ValueTracking.cpp
@@ -229,6 +229,19 @@ static bool haveNoCommonBitsSetSpecialCases(const Value *LHS, const Value *RHS,
return true;
}
+ // Look for: (X << V) op (Y >> (BitWidth - V))
+ // or (X >> V) op (Y << (BitWidth - V))
+ {
+ const Value *V;
+ const APInt *R;
+ if (((match(RHS, m_Shl(m_Value(), m_Sub(m_APInt(R), m_Value(V)))) &&
+ match(LHS, m_LShr(m_Value(), m_Specific(V)))) ||
+ (match(RHS, m_LShr(m_Value(), m_Sub(m_APInt(R), m_Value(V)))) &&
+ match(LHS, m_Shl(m_Value(), m_Specific(V))))) &&
+ R->uge(LHS->getType()->getScalarSizeInBits()))
+ return true;
+ }
+
return false;
}