[llvm-commits] [llvm] r60687 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Chris Lattner
sabre at nondot.org
Sun Dec 7 22:28:54 PST 2008
Author: lattner
Date: Mon Dec 8 00:28:54 2008
New Revision: 60687
URL: http://llvm.org/viewvc/llvm-project?rev=60687&view=rev
Log:
Some minor optimizations for isObjectSmallerThan.
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=60687&r1=60686&r2=60687&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Dec 8 00:28:54 2008
@@ -164,19 +164,24 @@
/// 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;
}
More information about the llvm-commits
mailing list