summaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorVictor Hernandez <vhernandez@apple.com>2009-10-17 01:18:07 +0000
committerVictor Hernandez <vhernandez@apple.com>2009-10-17 01:18:07 +0000
commita276c603b82a11b0bf0b59f0517a69e4b63adeab (patch)
tree0bf9c9f1be6d75c1fd4a5811844e196eec7636c9 /lib/Analysis
parent3bdd8de2806e47f34369c1e6ce6e6b44a135bd29 (diff)
downloadexternal_llvm-a276c603b82a11b0bf0b59f0517a69e4b63adeab.zip
external_llvm-a276c603b82a11b0bf0b59f0517a69e4b63adeab.tar.gz
external_llvm-a276c603b82a11b0bf0b59f0517a69e4b63adeab.tar.bz2
Remove MallocInst from LLVM Instructions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@84299 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp5
-rw-r--r--lib/Analysis/InlineCost.cpp2
-rw-r--r--lib/Analysis/InstCount.cpp4
-rw-r--r--lib/Analysis/ValueTracking.cpp21
4 files changed, 8 insertions, 24 deletions
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index f5c1108..7949288 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -303,7 +303,7 @@ bool GlobalsModRef::AnalyzeIndirectGlobalMemory(GlobalValue *GV) {
// Check the value being stored.
Value *Ptr = SI->getOperand(0)->getUnderlyingObject();
- if (isa<MallocInst>(Ptr) || isMalloc(Ptr)) {
+ if (isMalloc(Ptr)) {
// Okay, easy case.
} else if (CallInst *CI = dyn_cast<CallInst>(Ptr)) {
Function *F = CI->getCalledFunction();
@@ -439,8 +439,7 @@ void GlobalsModRef::AnalyzeCallGraph(CallGraph &CG, Module &M) {
if (cast<StoreInst>(*II).isVolatile())
// Treat volatile stores as reading memory somewhere.
FunctionEffect |= Ref;
- } else if (isa<MallocInst>(*II) || isa<FreeInst>(*II) ||
- isMalloc(&cast<Instruction>(*II))) {
+ } else if (isMalloc(&cast<Instruction>(*II)) || isa<FreeInst>(*II)) {
FunctionEffect |= ModRef;
}
diff --git a/lib/Analysis/InlineCost.cpp b/lib/Analysis/InlineCost.cpp
index 3b0d2c9..b833baa 100644
--- a/lib/Analysis/InlineCost.cpp
+++ b/lib/Analysis/InlineCost.cpp
@@ -131,7 +131,7 @@ void CodeMetrics::analyzeBasicBlock(const BasicBlock *BB) {
}
// These, too, are calls.
- if (isa<MallocInst>(II) || isa<FreeInst>(II))
+ if (isa<FreeInst>(II))
NumInsts += InlineConstants::CallPenalty;
if (const AllocaInst *AI = dyn_cast<AllocaInst>(II)) {
diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp
index 83724ca..4cde793 100644
--- a/lib/Analysis/InstCount.cpp
+++ b/lib/Analysis/InstCount.cpp
@@ -76,11 +76,11 @@ FunctionPass *llvm::createInstCountPass() { return new InstCount(); }
bool InstCount::runOnFunction(Function &F) {
unsigned StartMemInsts =
NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +
- NumInvokeInst + NumAllocaInst + NumMallocInst + NumFreeInst;
+ NumInvokeInst + NumAllocaInst + NumFreeInst;
visit(F);
unsigned EndMemInsts =
NumGetElementPtrInst + NumLoadInst + NumStoreInst + NumCallInst +
- NumInvokeInst + NumAllocaInst + NumMallocInst + NumFreeInst;
+ NumInvokeInst + NumAllocaInst + NumFreeInst;
TotalMemInst += EndMemInsts-StartMemInsts;
return false;
}
diff --git a/lib/Analysis/ValueTracking.cpp b/lib/Analysis/ValueTracking.cpp
index baa347a..dc0d489 100644
--- a/lib/Analysis/ValueTracking.cpp
+++ b/lib/Analysis/ValueTracking.cpp
@@ -469,26 +469,11 @@ void llvm::ComputeMaskedBits(Value *V, const APInt &Mask,
break;
}
- case Instruction::Alloca:
- case Instruction::Malloc: {
+ case Instruction::Alloca: {
AllocationInst *AI = cast<AllocationInst>(V);
unsigned Align = AI->getAlignment();
- if (Align == 0 && TD) {
- if (isa<AllocaInst>(AI))
- Align = TD->getABITypeAlignment(AI->getType()->getElementType());
- else if (isa<MallocInst>(AI)) {
- // Malloc returns maximally aligned memory.
- Align = TD->getABITypeAlignment(AI->getType()->getElementType());
- Align =
- std::max(Align,
- (unsigned)TD->getABITypeAlignment(
- Type::getDoubleTy(V->getContext())));
- Align =
- std::max(Align,
- (unsigned)TD->getABITypeAlignment(
- Type::getInt64Ty(V->getContext())));
- }
- }
+ if (Align == 0 && TD)
+ Align = TD->getABITypeAlignment(AI->getType()->getElementType());
if (Align > 0)
KnownZero = Mask & APInt::getLowBitsSet(BitWidth,