Changeset View
Changeset View
Standalone View
Standalone View
lib/Analysis/InstructionSimplify.cpp
Show First 20 Lines • Show All 4,509 Lines • ▼ Show 20 Lines | if (NumOperands == 1) { | ||||
case Intrinsic::bitreverse: { | case Intrinsic::bitreverse: { | ||||
Value *IIOperand = *ArgBegin; | Value *IIOperand = *ArgBegin; | ||||
Value *X = nullptr; | Value *X = nullptr; | ||||
// bitreverse(bitreverse(x)) -> x | // bitreverse(bitreverse(x)) -> x | ||||
if (match(IIOperand, m_BitReverse(m_Value(X)))) | if (match(IIOperand, m_BitReverse(m_Value(X)))) | ||||
return X; | return X; | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
case Intrinsic::exp: { | |||||
if (Q.CxtI->isFast()) { | |||||
Value *IIOperand = *ArgBegin; | |||||
spatel: I don't see much value in naming this local (could just use *ArgBegin in the line below here). | |||||
Value *X = nullptr; | |||||
Not Done ReplyInline ActionsAs I've said in other reviews, I think explicitly setting this to nullptr is just noise. spatel: As I've said in other reviews, I think explicitly setting this to nullptr is just noise. | |||||
// exp(log(x)) -> x | |||||
if (match(IIOperand, m_Intrinsic<Intrinsic::log>(m_Value(X)))) | |||||
return X; | |||||
} | |||||
return nullptr; | |||||
} | |||||
case Intrinsic::exp2: { | |||||
if (Q.CxtI->isFast()) { | |||||
Value *IIOperand = *ArgBegin; | |||||
Value *X = nullptr; | |||||
// exp2(log2(x)) -> x | |||||
if (match(IIOperand, m_Intrinsic<Intrinsic::log2>(m_Value(X)))) | |||||
return X; | |||||
} | |||||
return nullptr; | |||||
} | |||||
case Intrinsic::log: { | |||||
if (Q.CxtI->isFast()) { | |||||
Value *IIOperand = *ArgBegin; | |||||
Value *X = nullptr; | |||||
// log(exp(x)) -> x | |||||
if (match(IIOperand, m_Intrinsic<Intrinsic::exp>(m_Value(X)))) | |||||
return X; | |||||
} | |||||
return nullptr; | |||||
} | |||||
case Intrinsic::log2: { | |||||
if (Q.CxtI->isFast()) { | |||||
Value *IIOperand = *ArgBegin; | |||||
Value *X = nullptr; | |||||
// log2(exp2(x)) -> x | |||||
if (match(IIOperand, m_Intrinsic<Intrinsic::exp2>(m_Value(X)))) | |||||
return X; | |||||
} | |||||
return nullptr; | |||||
} | |||||
default: | default: | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
// Binary Ops | // Binary Ops | ||||
if (NumOperands == 2) { | if (NumOperands == 2) { | ||||
Value *LHS = *ArgBegin; | Value *LHS = *ArgBegin; | ||||
▲ Show 20 Lines • Show All 403 Lines • Show Last 20 Lines |
I don't see much value in naming this local (could just use *ArgBegin in the line below here).
So you could shrink this down to: