From 3b6bb79578bcc09b6a588af488da4f6e6d958f01 Mon Sep 17 00:00:00 2001 From: Stephen Lin Date: Fri, 26 Jul 2013 17:55:00 +0000 Subject: [PATCH] Correct case of m_UIToFp to m_UIToFP to match instruction name, add m_SIToFP for consistency. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187225 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/Support/PatternMatch.h | 9 ++++++++- lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 8 ++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/include/llvm/Support/PatternMatch.h b/include/llvm/Support/PatternMatch.h index 95d9d782ec0..35a9c07b75c 100644 --- a/include/llvm/Support/PatternMatch.h +++ b/include/llvm/Support/PatternMatch.h @@ -696,10 +696,17 @@ m_ZExt(const OpTy &Op) { /// m_UIToFP template inline CastClass_match -m_UIToFp(const OpTy &Op) { +m_UIToFP(const OpTy &Op) { return CastClass_match(Op); } +/// m_SIToFP +template +inline CastClass_match +m_SIToFP(const OpTy &Op) { + return CastClass_match(Op); +} + //===----------------------------------------------------------------------===// // Matchers for unary operators // diff --git a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 780e0eb0dcb..cc6a3015408 100644 --- a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -560,10 +560,10 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) { if (I.hasNoNaNs() && I.hasNoInfs() && I.hasNoSignedZeros()) { Value *LHS = Op0, *RHS = Op1; Value *B, *C; - if (!match(RHS, m_UIToFp(m_Value(C)))) + if (!match(RHS, m_UIToFP(m_Value(C)))) std::swap(LHS, RHS); - if (match(RHS, m_UIToFp(m_Value(C))) && C->getType()->isIntegerTy(1)) { + if (match(RHS, m_UIToFP(m_Value(C))) && C->getType()->isIntegerTy(1)) { B = LHS; Value *Zero = ConstantFP::getNegativeZero(B->getType()); return SelectInst::Create(C, B, Zero); @@ -574,10 +574,10 @@ Instruction *InstCombiner::visitFMul(BinaryOperator &I) { if (I.hasNoNaNs() && I.hasNoInfs() && I.hasNoSignedZeros()) { Value *LHS = Op0, *RHS = Op1; Value *A, *C; - if (!match(RHS, m_FSub(m_FPOne(), m_UIToFp(m_Value(C))))) + if (!match(RHS, m_FSub(m_FPOne(), m_UIToFP(m_Value(C))))) std::swap(LHS, RHS); - if (match(RHS, m_FSub(m_FPOne(), m_UIToFp(m_Value(C)))) && + if (match(RHS, m_FSub(m_FPOne(), m_UIToFP(m_Value(C)))) && C->getType()->isIntegerTy(1)) { A = LHS; Value *Zero = ConstantFP::getNegativeZero(A->getType()); -- 2.34.1