# Changeset View

Changeset View

# Standalone View

Standalone View

# lib/Analysis/InstructionSimplify.cpp

Show First 20 Lines • Show All 4509 Lines • ▼ Show 20 Line(s) | 4487 | if (NumOperands == 1) { | |||
---|---|---|---|---|---|

4510 | case Intrinsic::bitreverse: { | 4510 | case Intrinsic::bitreverse: { | ||

4511 | Value *IIOperand = *ArgBegin; | 4511 | Value *IIOperand = *ArgBegin; | ||

4512 | Value *X = nullptr; | 4512 | Value *X = nullptr; | ||

4513 | // bitreverse(bitreverse(x)) -> x | 4513 | // bitreverse(bitreverse(x)) -> x | ||

4514 | if (match(IIOperand, m_BitReverse(m_Value(X)))) | 4514 | if (match(IIOperand, m_BitReverse(m_Value(X)))) | ||

4515 | return X; | 4515 | return X; | ||

4516 | return nullptr; | 4516 | return nullptr; | ||

4517 | } | 4517 | } | ||

4518 | case Intrinsic::exp: { | ||||

4519 | if (Q.CxtI->isFast()) { | ||||

4520 | Value *IIOperand = *ArgBegin; | ||||

spatel: I don't see much value in naming this local (could just use *ArgBegin in the line below here). | |||||

4521 | Value *X = nullptr; | ||||

spatelUnsubmitted Not Done ReplyAs 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. | |||||

4522 | // exp(log(x)) -> x | ||||

4523 | if (match(IIOperand, m_Intrinsic<Intrinsic::log>(m_Value(X)))) | ||||

4524 | return X; | ||||

4525 | } | ||||

4526 | return nullptr; | ||||

4527 | } | ||||

4528 | case Intrinsic::exp2: { | ||||

4529 | if (Q.CxtI->isFast()) { | ||||

4530 | Value *IIOperand = *ArgBegin; | ||||

4531 | Value *X = nullptr; | ||||

4532 | // exp2(log2(x)) -> x | ||||

4533 | if (match(IIOperand, m_Intrinsic<Intrinsic::log2>(m_Value(X)))) | ||||

4534 | return X; | ||||

4535 | } | ||||

4536 | return nullptr; | ||||

4537 | } | ||||

4538 | case Intrinsic::log: { | ||||

4539 | if (Q.CxtI->isFast()) { | ||||

4540 | Value *IIOperand = *ArgBegin; | ||||

4541 | Value *X = nullptr; | ||||

4542 | // log(exp(x)) -> x | ||||

4543 | if (match(IIOperand, m_Intrinsic<Intrinsic::exp>(m_Value(X)))) | ||||

4544 | return X; | ||||

4545 | } | ||||

4546 | return nullptr; | ||||

4547 | } | ||||

4548 | case Intrinsic::log2: { | ||||

4549 | if (Q.CxtI->isFast()) { | ||||

4550 | Value *IIOperand = *ArgBegin; | ||||

4551 | Value *X = nullptr; | ||||

4552 | // log2(exp2(x)) -> x | ||||

4553 | if (match(IIOperand, m_Intrinsic<Intrinsic::exp2>(m_Value(X)))) | ||||

4554 | return X; | ||||

4555 | } | ||||

4556 | return nullptr; | ||||

4557 | } | ||||

4518 | default: | 4558 | default: | ||

4519 | return nullptr; | 4559 | return nullptr; | ||

4520 | } | 4560 | } | ||

4521 | } | 4561 | } | ||

4522 | 4562 | | |||

4523 | // Binary Ops | 4563 | // Binary Ops | ||

4524 | if (NumOperands == 2) { | 4564 | if (NumOperands == 2) { | ||

4525 | Value *LHS = *ArgBegin; | 4565 | 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: