From 60de63d0b615bfdb0f098a7c4b9bdd5f5b7429a0 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sun, 9 Oct 2005 06:36:35 +0000 Subject: [PATCH] Fix funky xcode indentation git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23674 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../Scalar/InstructionCombining.cpp | 100 +++++++++--------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp index d98f1f14d65..7f74db50ca1 100644 --- a/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/lib/Transforms/Scalar/InstructionCombining.cpp @@ -402,59 +402,59 @@ static bool MaskedValueIsZero(Value *V, ConstantIntegral *Mask) { if (Instruction *I = dyn_cast(V)) { switch (I->getOpcode()) { - case Instruction::And: - // (X & C1) & C2 == 0 iff C1 & C2 == 0. - if (ConstantIntegral *CI = dyn_cast(I->getOperand(1))) - if (ConstantExpr::getAnd(CI, Mask)->isNullValue()) - return true; - break; - case Instruction::Or: - // If the LHS and the RHS are MaskedValueIsZero, the result is also zero. - return MaskedValueIsZero(I->getOperand(1), Mask) && - MaskedValueIsZero(I->getOperand(0), Mask); - case Instruction::Select: - // If the T and F values are MaskedValueIsZero, the result is also zero. - return MaskedValueIsZero(I->getOperand(2), Mask) && - MaskedValueIsZero(I->getOperand(1), Mask); - case Instruction::Cast: { - const Type *SrcTy = I->getOperand(0)->getType(); - if (SrcTy == Type::BoolTy) - return (Mask->getRawValue() & 1) == 0; + case Instruction::And: + // (X & C1) & C2 == 0 iff C1 & C2 == 0. + if (ConstantIntegral *CI = dyn_cast(I->getOperand(1))) + if (ConstantExpr::getAnd(CI, Mask)->isNullValue()) + return true; + break; + case Instruction::Or: + // If the LHS and the RHS are MaskedValueIsZero, the result is also zero. + return MaskedValueIsZero(I->getOperand(1), Mask) && + MaskedValueIsZero(I->getOperand(0), Mask); + case Instruction::Select: + // If the T and F values are MaskedValueIsZero, the result is also zero. + return MaskedValueIsZero(I->getOperand(2), Mask) && + MaskedValueIsZero(I->getOperand(1), Mask); + case Instruction::Cast: { + const Type *SrcTy = I->getOperand(0)->getType(); + if (SrcTy == Type::BoolTy) + return (Mask->getRawValue() & 1) == 0; + + if (SrcTy->isInteger()) { + // (cast X to int) & C2 == 0 iff could not have contained C2. + if (SrcTy->isUnsigned() && // Only handle zero ext. + ConstantExpr::getCast(Mask, SrcTy)->isNullValue()) + return true; - if (SrcTy->isInteger()) { - // (cast X to int) & C2 == 0 iff could not have contained C2. - if (SrcTy->isUnsigned() && // Only handle zero ext. - ConstantExpr::getCast(Mask, SrcTy)->isNullValue()) - return true; - - // If this is a noop cast, recurse. - if ((SrcTy->isSigned() && SrcTy->getUnsignedVersion() == I->getType())|| - SrcTy->getSignedVersion() == I->getType()) { - Constant *NewMask = - ConstantExpr::getCast(Mask, I->getOperand(0)->getType()); - return MaskedValueIsZero(I->getOperand(0), - cast(NewMask)); - } + // If this is a noop cast, recurse. + if ((SrcTy->isSigned() && SrcTy->getUnsignedVersion() == I->getType())|| + SrcTy->getSignedVersion() == I->getType()) { + Constant *NewMask = + ConstantExpr::getCast(Mask, I->getOperand(0)->getType()); + return MaskedValueIsZero(I->getOperand(0), + cast(NewMask)); } - break; } - case Instruction::Shl: - // (shl X, C1) & C2 == 0 iff (X & C2 >>u C1) == 0 - if (ConstantUInt *SA = dyn_cast(I->getOperand(1))) - return MaskedValueIsZero(I->getOperand(0), - cast(ConstantExpr::getUShr(Mask, SA))); - break; - case Instruction::Shr: - // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 - if (ConstantUInt *SA = dyn_cast(I->getOperand(1))) - if (I->getType()->isUnsigned()) { - Constant *C1 = ConstantIntegral::getAllOnesValue(I->getType()); - C1 = ConstantExpr::getShr(C1, SA); - C1 = ConstantExpr::getAnd(C1, Mask); - if (C1->isNullValue()) - return true; - } - break; + break; + } + case Instruction::Shl: + // (shl X, C1) & C2 == 0 iff (X & C2 >>u C1) == 0 + if (ConstantUInt *SA = dyn_cast(I->getOperand(1))) + return MaskedValueIsZero(I->getOperand(0), + cast(ConstantExpr::getUShr(Mask, SA))); + break; + case Instruction::Shr: + // (ushr X, C1) & C2 == 0 iff (-1 >> C1) & C2 == 0 + if (ConstantUInt *SA = dyn_cast(I->getOperand(1))) + if (I->getType()->isUnsigned()) { + Constant *C1 = ConstantIntegral::getAllOnesValue(I->getType()); + C1 = ConstantExpr::getShr(C1, SA); + C1 = ConstantExpr::getAnd(C1, Mask); + if (C1->isNullValue()) + return true; + } + break; } } -- 2.34.1