reduce indentation by using early exits, no functionality change.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@62350 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2009-01-16 20:08:59 +00:00
parent 99ec3538b8
commit 1b8eaf5109

View File

@ -11145,10 +11145,14 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
Value *CastOp = CI->getOperand(0);
const Type *DestPTy = cast<PointerType>(CI->getType())->getElementType();
if (const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType())) {
const PointerType *SrcTy = dyn_cast<PointerType>(CastOp->getType());
if (SrcTy == 0) return 0;
const Type *SrcPTy = SrcTy->getElementType();
if (DestPTy->isInteger() || isa<PointerType>(DestPTy)) {
if (!DestPTy->isInteger() && !isa<PointerType>(DestPTy))
return 0;
// If the source is an array, the code below will not succeed. Check to
// see if a trivial 'gep P, 0, 0' will help matters. Only do this for
// constants.
@ -11162,9 +11166,12 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
SrcPTy = SrcTy->getElementType();
}
if ((SrcPTy->isInteger() || isa<PointerType>(SrcPTy)) &&
IC.getTargetData().getTypeSizeInBits(SrcPTy) ==
IC.getTargetData().getTypeSizeInBits(DestPTy)) {
if (!SrcPTy->isInteger() && !isa<PointerType>(SrcPTy))
return 0;
if (IC.getTargetData().getTypeSizeInBits(SrcPTy) !=
IC.getTargetData().getTypeSizeInBits(DestPTy))
return 0;
// Okay, we are casting from one integer or pointer type to another of
// the same size. Instead of casting the pointer before
@ -11189,10 +11196,6 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
SI);
return new StoreInst(NewCast, CastOp);
}
}
}
return 0;
}
/// equivalentAddressValues - Test if A and B will obviously have the same
/// value. This includes recognizing that %t0 and %t1 will have the same