mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-19 06:31:18 +00:00
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:
parent
99ec3538b8
commit
1b8eaf5109
@ -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
|
||||
@ -11188,10 +11195,6 @@ static Instruction *InstCombineStoreToCast(InstCombiner &IC, StoreInst &SI) {
|
||||
CastInst::Create(opcode, SIOp0, CastDstTy, SIOp0->getName()+".c"),
|
||||
SI);
|
||||
return new StoreInst(NewCast, CastOp);
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// equivalentAddressValues - Test if A and B will obviously have the same
|
||||
|
Loading…
x
Reference in New Issue
Block a user