summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-04-04 22:06:03 +0000
committerSanjay Patel <spatel@rotateright.com>2017-04-04 22:06:03 +0000
commit0bf0abedf660c0b17646d00cc5baa07c435e143c (patch)
tree89f5fc8b1e4194eca09ce275e72f0b284547c924 /llvm/lib
parent51208a38de9ea04e3e36022c02db68d911e96d1a (diff)
downloadbcm5719-llvm-0bf0abedf660c0b17646d00cc5baa07c435e143c.tar.gz
bcm5719-llvm-0bf0abedf660c0b17646d00cc5baa07c435e143c.zip
[InstCombine] rename variable for easier reading; NFC
We usually give constants a 'C' somewhere in the name... llvm-svn: 299474
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
index cb76902321a..b9c73370f96 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineAddSub.cpp
@@ -1042,9 +1042,9 @@ Instruction *InstCombiner::visitAdd(BinaryOperator &I) {
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(BinaryOperator &I) {
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(BinaryOperator &I) {
return BinaryOperator::CreateOr(A, B);
}
+
// (add (or A, B) (and A, B)) --> (add A, B)
{
Value *A = nullptr, *B = nullptr;
OpenPOWER on IntegriCloud