[llvm] r299474 - [InstCombine] rename variable for easier reading; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 4 15:06:04 PDT 2017
Author: spatel
Date: Tue Apr 4 17:06:03 2017
New Revision: 299474
URL: http://llvm.org/viewvc/llvm-project?rev=299474&view=rev
Log:
[InstCombine] rename variable for easier reading; NFC
We usually give constants a 'C' somewhere in the name...
Modified:
llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp?rev=299474&r1=299473&r2=299474&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAddSub.cpp Tue Apr 4 17:06:03 2017
@@ -1042,9 +1042,9 @@ Instruction *InstCombiner::visitAdd(Bina
if (Value *V = SimplifyUsingDistributiveLaws(I))
return replaceInstUsesWith(I, V);
- const APInt *Val;
- if (match(RHS, m_APInt(Val))) {
- if (Val->isSignBit()) {
+ const APInt *RHSC;
+ if (match(RHS, m_APInt(RHSC))) {
+ if (RHSC->isSignBit()) {
// If wrapping is not allowed, then the addition must set the sign bit:
// X + (signbit) --> X | signbit
if (I.hasNoSignedWrap() || I.hasNoUnsignedWrap())
@@ -1060,17 +1060,17 @@ Instruction *InstCombiner::visitAdd(Bina
const APInt *C;
if (match(LHS, m_ZExt(m_Xor(m_Value(X), m_APInt(C)))) &&
C->isMinSignedValue() &&
- C->sext(LHS->getType()->getScalarSizeInBits()) == *Val) {
+ C->sext(LHS->getType()->getScalarSizeInBits()) == *RHSC) {
// add(zext(xor i16 X, -32768), -32768) --> sext X
return CastInst::Create(Instruction::SExt, X, LHS->getType());
}
- if (Val->isNegative() &&
+ if (RHSC->isNegative() &&
match(LHS, m_ZExt(m_NUWAdd(m_Value(X), m_APInt(C)))) &&
- Val->sge(-C->sext(Val->getBitWidth()))) {
+ RHSC->sge(-C->sext(RHSC->getBitWidth()))) {
// (add (zext (add nuw X, C)), Val) -> (zext (add nuw X, C+Val))
Constant *NewC =
- ConstantInt::get(X->getType(), *C + Val->trunc(C->getBitWidth()));
+ ConstantInt::get(X->getType(), *C + RHSC->trunc(C->getBitWidth()));
return new ZExtInst(Builder->CreateNUWAdd(X, NewC), I.getType());
}
}
@@ -1320,6 +1320,7 @@ Instruction *InstCombiner::visitAdd(Bina
return BinaryOperator::CreateOr(A, B);
}
+
// (add (or A, B) (and A, B)) --> (add A, B)
{
Value *A = nullptr, *B = nullptr;
More information about the llvm-commits
mailing list