fix formatting; NFC

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219645 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Sanjay Patel 2014-10-14 00:33:23 +00:00
parent ab1f4ef9a2
commit e0a0018345

View File

@ -304,40 +304,32 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
return Changed ? &I : nullptr; return Changed ? &I : nullptr;
} }
// /// Detect pattern log2(Y * 0.5) with corresponding fast math flags.
// Detect pattern:
//
// log2(Y*0.5)
//
// And check for corresponding fast math flags
//
static void detectLog2OfHalf(Value *&Op, Value *&Y, IntrinsicInst *&Log2) { static void detectLog2OfHalf(Value *&Op, Value *&Y, IntrinsicInst *&Log2) {
if (!Op->hasOneUse())
return;
if (!Op->hasOneUse()) IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op);
return; if (!II)
return;
if (II->getIntrinsicID() != Intrinsic::log2 || !II->hasUnsafeAlgebra())
return;
Log2 = II;
IntrinsicInst *II = dyn_cast<IntrinsicInst>(Op); Value *OpLog2Of = II->getArgOperand(0);
if (!II) if (!OpLog2Of->hasOneUse())
return; return;
if (II->getIntrinsicID() != Intrinsic::log2 || !II->hasUnsafeAlgebra())
return;
Log2 = II;
Value *OpLog2Of = II->getArgOperand(0); Instruction *I = dyn_cast<Instruction>(OpLog2Of);
if (!OpLog2Of->hasOneUse()) if (!I)
return; return;
if (I->getOpcode() != Instruction::FMul || !I->hasUnsafeAlgebra())
return;
Instruction *I = dyn_cast<Instruction>(OpLog2Of); if (match(I->getOperand(0), m_SpecificFP(0.5)))
if (!I) Y = I->getOperand(1);
return; else if (match(I->getOperand(1), m_SpecificFP(0.5)))
if (I->getOpcode() != Instruction::FMul || !I->hasUnsafeAlgebra()) Y = I->getOperand(0);
return;
if (match(I->getOperand(0), m_SpecificFP(0.5)))
Y = I->getOperand(1);
else if (match(I->getOperand(1), m_SpecificFP(0.5)))
Y = I->getOperand(0);
} }
static bool isFiniteNonZeroFp(Constant *C) { static bool isFiniteNonZeroFp(Constant *C) {