From 6c20c1da1e5cb1b014043f2ef3bba2550d5f5a67 Mon Sep 17 00:00:00 2001 From: Jessica Paquette Date: Fri, 13 Nov 2020 09:28:37 -0800 Subject: [PATCH] [AArch64][GlobalISel] NFC: Use CmpInst::isUnsigned instead of static helper Reducing some code duplication. We had a helper for checking if a predicate is unsigned. Remove that and use the existing function in Instructions.cpp. Differential Revision: https://reviews.llvm.org/D91288 --- .../Target/AArch64/GISel/AArch64InstructionSelector.cpp | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp index 4584308..f7d3bcf 100644 --- a/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp +++ b/llvm/lib/Target/AArch64/GISel/AArch64InstructionSelector.cpp @@ -1089,19 +1089,6 @@ AArch64InstructionSelector::emitSelect(Register Dst, Register True, return &*SelectInst; } -/// Returns true if \p P is an unsigned integer comparison predicate. -static bool isUnsignedICMPPred(const CmpInst::Predicate P) { - switch (P) { - default: - return false; - case CmpInst::ICMP_UGT: - case CmpInst::ICMP_UGE: - case CmpInst::ICMP_ULT: - case CmpInst::ICMP_ULE: - return true; - } -} - static AArch64CC::CondCode changeICMPPredToAArch64CC(CmpInst::Predicate P) { switch (P) { default: @@ -4379,7 +4366,7 @@ MachineInstr *AArch64InstructionSelector::tryFoldIntegerCompare( // Produce this if the compare is signed: // // tst x, y - if (!isUnsignedICMPPred(P) && LHSDef && + if (!CmpInst::isUnsigned(P) && LHSDef && LHSDef->getOpcode() == TargetOpcode::G_AND) { // Make sure that the RHS is 0. auto ValAndVReg = getConstantVRegValWithLookThrough(RHS.getReg(), MRI); -- 2.7.4