Skip to content

Commit 715dcb2

Browse files
authored
[ExpandMemCmp] Use m_SpecificInt to simplify code. NFC (#121532)
1 parent 4dfea22 commit 715dcb2

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/lib/CodeGen/ExpandMemCmp.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -669,15 +669,15 @@ Value *MemCmpExpansion::getMemCmpOneBlock() {
669669
if (CI->hasOneUser()) {
670670
auto *UI = cast<Instruction>(*CI->user_begin());
671671
CmpPredicate Pred = ICmpInst::Predicate::BAD_ICMP_PREDICATE;
672-
uint64_t Shift;
673672
bool NeedsZExt = false;
674673
// This is a special case because instead of checking if the result is less
675674
// than zero:
676675
// bool result = memcmp(a, b, NBYTES) < 0;
677676
// Compiler is clever enough to generate the following code:
678677
// bool result = memcmp(a, b, NBYTES) >> 31;
679-
if (match(UI, m_LShr(m_Value(), m_ConstantInt(Shift))) &&
680-
Shift == (CI->getType()->getIntegerBitWidth() - 1)) {
678+
if (match(UI,
679+
m_LShr(m_Value(),
680+
m_SpecificInt(CI->getType()->getIntegerBitWidth() - 1)))) {
681681
Pred = ICmpInst::ICMP_SLT;
682682
NeedsZExt = true;
683683
} else {

0 commit comments

Comments
 (0)