mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-04-09 16:45:03 +00:00
Some minor optimizations for isObjectSmallerThan.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@60687 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
fb4b58c9aa
commit
295d4e953a
@ -164,19 +164,24 @@ static bool isNonEscapingLocalObject(const Value *V) {
|
||||
/// by V is smaller than Size.
|
||||
static bool isObjectSmallerThan(const Value *V, unsigned Size,
|
||||
const TargetData &TD) {
|
||||
const Type *AccessTy = 0;
|
||||
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V))
|
||||
const Type *AccessTy;
|
||||
if (const GlobalVariable *GV = dyn_cast<GlobalVariable>(V)) {
|
||||
AccessTy = GV->getType()->getElementType();
|
||||
|
||||
if (const AllocationInst *AI = dyn_cast<AllocationInst>(V))
|
||||
} else if (const AllocationInst *AI = dyn_cast<AllocationInst>(V)) {
|
||||
if (!AI->isArrayAllocation())
|
||||
AccessTy = AI->getType()->getElementType();
|
||||
|
||||
if (const Argument *A = dyn_cast<Argument>(V))
|
||||
else
|
||||
return false;
|
||||
} else if (const Argument *A = dyn_cast<Argument>(V)) {
|
||||
if (A->hasByValAttr())
|
||||
AccessTy = cast<PointerType>(A->getType())->getElementType();
|
||||
else
|
||||
return false;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (AccessTy && AccessTy->isSized())
|
||||
if (AccessTy->isSized())
|
||||
return TD.getABITypeSize(AccessTy) < Size;
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user