aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2007-01-30 20:08:39 +0000
committerReid Spencer <rspencer@reidspencer.com>2007-01-30 20:08:39 +0000
commit5cbf985dcbc89fba3208e7baf8b6f488b06d3ec9 (patch)
tree7207871f6b243dd1575dd474b14ed7e05be6b9e7 /lib/Transforms
parent2574fe5a226e9806cde064b0919c461babc3bf29 (diff)
For PR1136: Rename GlobalVariable::isExternal as isDeclaration to avoid
confusion with external linkage types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33663 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/IPO/DeadArgumentElimination.cpp2
-rw-r--r--lib/Transforms/IPO/ExtractFunction.cpp4
-rw-r--r--lib/Transforms/IPO/FunctionResolution.cpp18
-rw-r--r--lib/Transforms/IPO/GlobalDCE.cpp6
-rw-r--r--lib/Transforms/IPO/GlobalOpt.cpp4
-rw-r--r--lib/Transforms/IPO/IPConstantPropagation.cpp2
-rw-r--r--lib/Transforms/IPO/IndMemRemoval.cpp4
-rw-r--r--lib/Transforms/IPO/Inliner.cpp4
-rw-r--r--lib/Transforms/IPO/Internalize.cpp6
-rw-r--r--lib/Transforms/IPO/PruneEH.cpp4
-rw-r--r--lib/Transforms/IPO/RaiseAllocations.cpp4
-rw-r--r--lib/Transforms/IPO/SimplifyLibCalls.cpp2
-rw-r--r--lib/Transforms/Instrumentation/BlockProfiling.cpp4
-rw-r--r--lib/Transforms/Instrumentation/EmitFunctions.cpp2
-rw-r--r--lib/Transforms/Instrumentation/RSProfiling.cpp2
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp10
-rw-r--r--lib/Transforms/Scalar/LowerGC.cpp2
-rw-r--r--lib/Transforms/Scalar/Reg2Mem.cpp2
-rw-r--r--lib/Transforms/Scalar/SCCP.cpp8
-rw-r--r--lib/Transforms/Utils/CloneModule.cpp2
-rw-r--r--lib/Transforms/Utils/InlineFunction.cpp2
21 files changed, 47 insertions, 47 deletions
diff --git a/lib/Transforms/IPO/DeadArgumentElimination.cpp b/lib/Transforms/IPO/DeadArgumentElimination.cpp
index d83f3e027d..fd1be4dda2 100644
--- a/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -114,7 +114,7 @@ ModulePass *llvm::createDeadArgHackingPass() { return new DAH(); }
/// llvm.vastart is never called, the varargs list is dead for the function.
bool DAE::DeleteDeadVarargs(Function &Fn) {
assert(Fn.getFunctionType()->isVarArg() && "Function isn't varargs!");
- if (Fn.isExternal() || !Fn.hasInternalLinkage()) return false;
+ if (Fn.isDeclaration() || !Fn.hasInternalLinkage()) return false;
// Ensure that the function is only directly called.
for (Value::use_iterator I = Fn.use_begin(), E = Fn.use_end(); I != E; ++I) {
diff --git a/lib/Transforms/IPO/ExtractFunction.cpp b/lib/Transforms/IPO/ExtractFunction.cpp
index 3246cd96bb..0595b5c2f7 100644
--- a/lib/Transforms/IPO/ExtractFunction.cpp
+++ b/lib/Transforms/IPO/ExtractFunction.cpp
@@ -63,7 +63,7 @@ namespace {
Named->setLinkage(GlobalValue::ExternalLinkage);
Named->deleteBody();
- assert(Named->isExternal() && "This didn't make the function external!");
+ assert(Named->isDeclaration() && "This didn't make the function external!");
return true;
}
@@ -73,7 +73,7 @@ namespace {
// Mark all global variables internal
for (Module::global_iterator I = M.global_begin(), E = M.global_end(); I != E; ++I)
- if (!I->isExternal()) {
+ if (!I->isDeclaration()) {
I->setInitializer(0); // Make all variables external
I->setLinkage(GlobalValue::ExternalLinkage);
}
diff --git a/lib/Transforms/IPO/FunctionResolution.cpp b/lib/Transforms/IPO/FunctionResolution.cpp
index 2ffbc7b9ae..21f4a95e81 100644
--- a/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/lib/Transforms/IPO/FunctionResolution.cpp
@@ -174,13 +174,13 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
// to 'int (int)' or 'int ()' or whatever else is not completely generic.
//
Function *F = cast<Function>(Globals[i]);
- if (!F->isExternal()) {
- if (Concrete && !Concrete->isExternal())
+ if (!F->isDeclaration()) {
+ if (Concrete && !Concrete->isDeclaration())
return false; // Found two different functions types. Can't choose!
Concrete = Globals[i];
} else if (Concrete) {
- if (Concrete->isExternal()) // If we have multiple external symbols...
+ if (Concrete->isDeclaration()) // If we have multiple external symbols...
if (F->getFunctionType()->getNumParams() >
cast<Function>(Concrete)->getFunctionType()->getNumParams())
Concrete = F; // We are more concrete than "Concrete"!
@@ -190,7 +190,7 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
}
} else {
GlobalVariable *GV = cast<GlobalVariable>(Globals[i]);
- if (!GV->isExternal()) {
+ if (!GV->isDeclaration()) {
if (Concrete) {
cerr << "WARNING: Two global variables with external linkage"
<< " exist with the same name: '" << GV->getName()
@@ -211,7 +211,7 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
unsigned NumInstancesWithExternalLinkage = 0;
for (unsigned i = 0, e = Globals.size(); i != e; ++i) {
- if (Globals[i]->isExternal())
+ if (Globals[i]->isDeclaration())
HasExternal = true;
else if (!Globals[i]->hasInternalLinkage())
NumInstancesWithExternalLinkage++;
@@ -306,7 +306,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) {
bool Changed = false;
for (Module::iterator I = M.begin(), E = M.end(); I != E; ) {
Function *F = I++;
- if (F->use_empty() && F->isExternal()) {
+ if (F->use_empty() && F->isDeclaration()) {
M.getFunctionList().erase(F);
Changed = true;
} else if (!F->hasInternalLinkage() && !F->getName().empty() &&
@@ -317,7 +317,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) {
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ) {
GlobalVariable *GV = I++;
- if (GV->use_empty() && GV->isExternal()) {
+ if (GV->use_empty() && GV->isDeclaration()) {
M.getGlobalList().erase(GV);
Changed = true;
} else if (!GV->hasInternalLinkage() && !GV->getName().empty())
@@ -337,7 +337,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) {
// dead. If so, remove them now.
for (Module::iterator I = M.begin(), E = M.end(); I != E; )
- if (I->isExternal() && I->use_empty()) {
+ if (I->isDeclaration() && I->use_empty()) {
Function *F = I;
++I;
M.getFunctionList().erase(F);
@@ -349,7 +349,7 @@ bool FunctionResolvingPass::runOnModule(Module &M) {
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; )
- if (I->isExternal() && I->use_empty()) {
+ if (I->isDeclaration() && I->use_empty()) {
GlobalVariable *GV = I;
++I;
M.getGlobalList().erase(GV);
diff --git a/lib/Transforms/IPO/GlobalDCE.cpp b/lib/Transforms/IPO/GlobalDCE.cpp
index 17dcb31859..0f868f976b 100644
--- a/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/lib/Transforms/IPO/GlobalDCE.cpp
@@ -57,7 +57,7 @@ bool GlobalDCE::runOnModule(Module &M) {
Changed |= RemoveUnusedGlobalValue(*I);
// Functions with external linkage are needed if they have a body
if ((!I->hasInternalLinkage() && !I->hasLinkOnceLinkage()) &&
- !I->isExternal())
+ !I->isDeclaration())
GlobalIsNeeded(I);
}
@@ -66,7 +66,7 @@ bool GlobalDCE::runOnModule(Module &M) {
// Externally visible & appending globals are needed, if they have an
// initializer.
if ((!I->hasInternalLinkage() && !I->hasLinkOnceLinkage()) &&
- !I->isExternal())
+ !I->isDeclaration())
GlobalIsNeeded(I);
}
@@ -89,7 +89,7 @@ bool GlobalDCE::runOnModule(Module &M) {
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!AliveGlobals.count(I)) {
DeadFunctions.push_back(I); // Keep track of dead globals
- if (!I->isExternal())
+ if (!I->isDeclaration())
I->deleteBody();
}
diff --git a/lib/Transforms/IPO/GlobalOpt.cpp b/lib/Transforms/IPO/GlobalOpt.cpp
index d9ba12c784..02a3d08c05 100644
--- a/lib/Transforms/IPO/GlobalOpt.cpp
+++ b/lib/Transforms/IPO/GlobalOpt.cpp
@@ -1553,7 +1553,7 @@ static bool isSimpleEnoughPointerToCommit(Constant *C) {
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(C)) {
if (!GV->hasExternalLinkage() && !GV->hasInternalLinkage())
return false; // do not allow weak/linkonce/dllimport/dllexport linkage.
- return !GV->isExternal(); // reject external globals.
+ return !GV->isDeclaration(); // reject external globals.
}
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
// Handle a constantexpr gep.
@@ -1773,7 +1773,7 @@ static bool EvaluateFunction(Function *F, Constant *&RetVal,
for (unsigned i = 1, e = CI->getNumOperands(); i != e; ++i)
Formals.push_back(getVal(Values, CI->getOperand(i)));
- if (Callee->isExternal()) {
+ if (Callee->isDeclaration()) {
// If this is a function we can constant fold, do it.
if (Constant *C = ConstantFoldCall(Callee, Formals)) {
InstResult = C;
diff --git a/lib/Transforms/IPO/IPConstantPropagation.cpp b/lib/Transforms/IPO/IPConstantPropagation.cpp
index be18f002e8..daaa5a7121 100644
--- a/lib/Transforms/IPO/IPConstantPropagation.cpp
+++ b/lib/Transforms/IPO/IPConstantPropagation.cpp
@@ -51,7 +51,7 @@ bool IPCP::runOnModule(Module &M) {
while (LocalChange) {
LocalChange = false;
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
- if (!I->isExternal()) {
+ if (!I->isDeclaration()) {
// Delete any klingons.
I->removeDeadConstantUsers();
if (I->hasInternalLinkage())
diff --git a/lib/Transforms/IPO/IndMemRemoval.cpp b/lib/Transforms/IPO/IndMemRemoval.cpp
index fa414f25db..0d2f350e85 100644
--- a/lib/Transforms/IPO/IndMemRemoval.cpp
+++ b/lib/Transforms/IPO/IndMemRemoval.cpp
@@ -45,7 +45,7 @@ bool IndMemRemPass::runOnModule(Module &M) {
//happen through intrinsics.
bool changed = false;
if (Function* F = M.getNamedFunction("free")) {
- assert(F->isExternal() && "free not external?");
+ assert(F->isDeclaration() && "free not external?");
if (!F->use_empty()) {
Function* FN = new Function(F->getFunctionType(),
GlobalValue::LinkOnceLinkage,
@@ -60,7 +60,7 @@ bool IndMemRemPass::runOnModule(Module &M) {
}
}
if (Function* F = M.getNamedFunction("malloc")) {
- assert(F->isExternal() && "malloc not external?");
+ assert(F->isDeclaration() && "malloc not external?");
if (!F->use_empty()) {
Function* FN = new Function(F->getFunctionType(),
GlobalValue::LinkOnceLinkage,
diff --git a/lib/Transforms/IPO/Inliner.cpp b/lib/Transforms/IPO/Inliner.cpp
index 27dbf8ba50..b7ebe7781b 100644
--- a/lib/Transforms/IPO/Inliner.cpp
+++ b/lib/Transforms/IPO/Inliner.cpp
@@ -84,7 +84,7 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
for (BasicBlock::iterator I = BB->begin(); I != BB->end(); ++I) {
CallSite CS = CallSite::get(I);
if (CS.getInstruction() && (!CS.getCalledFunction() ||
- !CS.getCalledFunction()->isExternal()))
+ !CS.getCalledFunction()->isDeclaration()))
CallSites.push_back(CS);
}
@@ -109,7 +109,7 @@ bool Inliner::runOnSCC(const std::vector<CallGraphNode*> &SCC) {
for (unsigned CSi = 0; CSi != CallSites.size(); ++CSi)
if (Function *Callee = CallSites[CSi].getCalledFunction()) {
// Calls to external functions are never inlinable.
- if (Callee->isExternal() ||
+ if (Callee->isDeclaration() ||
CallSites[CSi].getInstruction()->getParent()->getParent() ==Callee){
if (SCC.size() == 1) {
std::swap(CallSites[CSi], CallSites.back());
diff --git a/lib/Transforms/IPO/Internalize.cpp b/lib/Transforms/IPO/Internalize.cpp
index e5bacf611a..54312b70b1 100644
--- a/lib/Transforms/IPO/Internalize.cpp
+++ b/lib/Transforms/IPO/Internalize.cpp
@@ -96,7 +96,7 @@ bool InternalizePass::runOnModule(Module &M) {
//
if (ExternalNames.empty()) {
Function *MainFunc = M.getMainFunction();
- if (MainFunc == 0 || MainFunc->isExternal())
+ if (MainFunc == 0 || MainFunc->isDeclaration())
return false; // No main found, must be a library...
// Preserve main, internalize all else.
@@ -107,7 +107,7 @@ bool InternalizePass::runOnModule(Module &M) {
// Found a main function, mark all functions not named main as internal.
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
- if (!I->isExternal() && // Function must be defined here
+ if (!I->isDeclaration() && // Function must be defined here
!I->hasInternalLinkage() && // Can't already have internal linkage
!ExternalNames.count(I->getName())) {// Not marked to keep external?
I->setLinkage(GlobalValue::InternalLinkage);
@@ -129,7 +129,7 @@ bool InternalizePass::runOnModule(Module &M) {
// Mark all global variables with initializers as internal as well.
for (Module::global_iterator I = M.global_begin(), E = M.global_end();
I != E; ++I)
- if (!I->isExternal() && !I->hasInternalLinkage() &&
+ if (!I->isDeclaration() && !I->hasInternalLinkage() &&
!ExternalNames.count(I->getName())) {
// Special case handling of the global ctor and dtor list. When we
// internalize it, we mark it constant, which allows elimination of
diff --git a/lib/Transforms/IPO/PruneEH.cpp b/lib/Transforms/IPO/PruneEH.cpp
index c9e3455c94..c92f428914 100644
--- a/lib/Transforms/IPO/PruneEH.cpp
+++ b/lib/Transforms/IPO/PruneEH.cpp
@@ -72,11 +72,11 @@ bool PruneEH::runOnSCC(const std::vector<CallGraphNode *> &SCC) {
for (unsigned i = 0, e = SCC.size();
(!SCCMightUnwind || !SCCMightReturn) && i != e; ++i) {
Function *F = SCC[i]->getFunction();
- if (F == 0 || (F->isExternal() && !F->getIntrinsicID())) {
+ if (F == 0 || (F->isDeclaration() && !F->getIntrinsicID())) {
SCCMightUnwind = true;
SCCMightReturn = true;
} else {
- if (F->isExternal())
+ if (F->isDeclaration())
SCCMightReturn = true;
// Check to see if this function performs an unwind or calls an
diff --git a/lib/Transforms/IPO/RaiseAllocations.cpp b/lib/Transforms/IPO/RaiseAllocations.cpp
index e7e57aa952..6082780e35 100644
--- a/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -109,8 +109,8 @@ void RaiseAllocations::doInitialization(Module &M) {
}
// Don't mess with locally defined versions of these functions...
- if (MallocFunc && !MallocFunc->isExternal()) MallocFunc = 0;
- if (FreeFunc && !FreeFunc->isExternal()) FreeFunc = 0;
+ if (MallocFunc && !MallocFunc->isDeclaration()) MallocFunc = 0;
+ if (FreeFunc && !FreeFunc->isDeclaration()) FreeFunc = 0;
}
// run - Transform calls into instructions...
diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp
index 037fef1a25..e4eb6e42c1 100644
--- a/lib/Transforms/IPO/SimplifyLibCalls.cpp
+++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp
@@ -177,7 +177,7 @@ public:
// because they live in a runtime library somewhere and were (probably)
// not compiled by LLVM. So, we only act on external functions that
// have external or dllimport linkage and non-empty uses.
- if (!FI->isExternal() ||
+ if (!FI->isDeclaration() ||
!(FI->hasExternalLinkage() || FI->hasDLLImportLinkage()) ||
FI->use_empty())
continue;
diff --git a/lib/Transforms/Instrumentation/BlockProfiling.cpp b/lib/Transforms/Instrumentation/BlockProfiling.cpp
index e7b86777cf..add1bf01ef 100644
--- a/lib/Transforms/Instrumentation/BlockProfiling.cpp
+++ b/lib/Transforms/Instrumentation/BlockProfiling.cpp
@@ -54,7 +54,7 @@ bool FunctionProfiler::runOnModule(Module &M) {
unsigned NumFunctions = 0;
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
- if (!I->isExternal())
+ if (!I->isDeclaration())
++NumFunctions;
const Type *ATy = ArrayType::get(Type::Int32Ty, NumFunctions);
@@ -65,7 +65,7 @@ bool FunctionProfiler::runOnModule(Module &M) {
// Instrument all of the functions...
unsigned i = 0;
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
- if (!I->isExternal())
+ if (!I->isDeclaration())
// Insert counter at the start of the function
IncrementCounterInBlock(I->begin(), i++, Counters);
diff --git a/lib/Transforms/Instrumentation/EmitFunctions.cpp b/lib/Transforms/Instrumentation/EmitFunctions.cpp
index 23fa4faaad..24c4f66419 100644
--- a/lib/Transforms/Instrumentation/EmitFunctions.cpp
+++ b/lib/Transforms/Instrumentation/EmitFunctions.cpp
@@ -81,7 +81,7 @@ bool EmitFunctionTable::runOnModule(Module &M){
unsigned int counter = 0;
for(Module::iterator MI = M.begin(), ME = M.end(); MI != ME; ++MI)
- if (!MI->isExternal()) {
+ if (!MI->isDeclaration()) {
vType.push_back(MI->getType());
//std::cerr<<MI;
diff --git a/lib/Transforms/Instrumentation/RSProfiling.cpp b/lib/Transforms/Instrumentation/RSProfiling.cpp
index c0a7a0569b..d6d152dfbf 100644
--- a/lib/Transforms/Instrumentation/RSProfiling.cpp
+++ b/lib/Transforms/Instrumentation/RSProfiling.cpp
@@ -499,7 +499,7 @@ void ProfilerRS::ProcessBackEdge(BasicBlock* src, BasicBlock* dst, Function& F)
}
bool ProfilerRS::runOnFunction(Function& F) {
- if (!F.isExternal()) {
+ if (!F.isDeclaration()) {
std::set<std::pair<BasicBlock*, BasicBlock*> > BackEdges;
RSProfilers& LI = getAnalysis<RSProfilers>();
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 12a886aebe..8ef285a482 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -7234,7 +7234,7 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
// Check to see if we are changing the return type...
if (OldRetTy != FT->getReturnType()) {
- if (Callee->isExternal() && !Caller->use_empty() &&
+ if (Callee->isDeclaration() && !Caller->use_empty() &&
OldRetTy != FT->getReturnType() &&
// Conversion is ok if changing from pointer to int of same size.
!(isa<PointerType>(FT->getReturnType()) &&
@@ -7270,11 +7270,11 @@ bool InstCombiner::transformConstExprCastCall(CallSite CS) {
ParamTy->getPrimitiveSizeInBits() >= ActTy->getPrimitiveSizeInBits()) ||
(c && ParamTy->getPrimitiveSizeInBits() >= ActTy->getPrimitiveSizeInBits()
&& c->getSExtValue() > 0);
- if (Callee->isExternal() && !isConvertible) return false;
+ if (Callee->isDeclaration() && !isConvertible) return false;
}
if (FT->getNumParams() < NumActualArgs && !FT->isVarArg() &&
- Callee->isExternal())
+ Callee->isDeclaration())
return false; // Do not delete arguments unless we have a function body...
// Okay, we decided that this is a safe thing to do: go ahead and start
@@ -8102,14 +8102,14 @@ Instruction *InstCombiner::visitLoadInst(LoadInst &LI) {
// Instcombine load (constant global) into the value loaded.
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Op))
- if (GV->isConstant() && !GV->isExternal())
+ if (GV->isConstant() && !GV->isDeclaration())
return ReplaceInstUsesWith(LI, GV->getInitializer());
// Instcombine load (constantexpr_GEP global, 0, ...) into the value loaded.
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Op))
if (CE->getOpcode() == Instruction::GetElementPtr) {
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
- if (GV->isConstant() && !GV->isExternal())
+ if (GV->isConstant() && !GV->isDeclaration())
if (Constant *V =
ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE))
return ReplaceInstUsesWith(LI, V);
diff --git a/lib/Transforms/Scalar/LowerGC.cpp b/lib/Transforms/Scalar/LowerGC.cpp
index fa06bd0dfc..a98981359d 100644
--- a/lib/Transforms/Scalar/LowerGC.cpp
+++ b/lib/Transforms/Scalar/LowerGC.cpp
@@ -130,7 +130,7 @@ bool LowerGC::doInitialization(Module &M) {
GlobalValue::LinkOnceLinkage,
Constant::getNullValue(PRLTy),
"llvm_gc_root_chain", &M);
- } else if (RootChain->hasExternalLinkage() && RootChain->isExternal()) {
+ } else if (RootChain->hasExternalLinkage() && RootChain->isDeclaration()) {
RootChain->setInitializer(Constant::getNullValue(PRLTy));
RootChain->setLinkage(GlobalValue::LinkOnceLinkage);
}
diff --git a/lib/Transforms/Scalar/Reg2Mem.cpp b/lib/Transforms/Scalar/Reg2Mem.cpp
index ee4a228dd1..a5faa422e4 100644
--- a/lib/Transforms/Scalar/Reg2Mem.cpp
+++ b/lib/Transforms/Scalar/Reg2Mem.cpp
@@ -49,7 +49,7 @@ namespace {
}
virtual bool runOnFunction(Function &F) {
- if (!F.isExternal()) {
+ if (!F.isDeclaration()) {
//give us a clean block
BasicBlock* bbold = &F.getEntryBlock();
BasicBlock* bbnew = new BasicBlock("allocablock", &F, &F.getEntryBlock());
diff --git a/lib/Transforms/Scalar/SCCP.cpp b/lib/Transforms/Scalar/SCCP.cpp
index 5d05ef86c3..f09ff0e8e1 100644
--- a/lib/Transforms/Scalar/SCCP.cpp
+++ b/lib/Transforms/Scalar/SCCP.cpp
@@ -1021,7 +1021,7 @@ void SCCPSolver::visitLoadInst(LoadInst &I) {
// Transform load (constant global) into the value loaded.
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(Ptr)) {
if (GV->isConstant()) {
- if (!GV->isExternal()) {
+ if (!GV->isDeclaration()) {
markConstant(IV, &I, GV->getInitializer());
return;
}
@@ -1040,7 +1040,7 @@ void SCCPSolver::visitLoadInst(LoadInst &I) {
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(Ptr))
if (CE->getOpcode() == Instruction::GetElementPtr)
if (GlobalVariable *GV = dyn_cast<GlobalVariable>(CE->getOperand(0)))
- if (GV->isConstant() && !GV->isExternal())
+ if (GV->isConstant() && !GV->isDeclaration())
if (Constant *V =
ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE)) {
markConstant(IV, &I, V);
@@ -1088,7 +1088,7 @@ void SCCPSolver::visitCallSite(CallSite CS) {
return;
}
- if (F == 0 || !F->isExternal() || !canConstantFoldCallTo(F)) {
+ if (F == 0 || !F->isDeclaration() || !canConstantFoldCallTo(F)) {
markOverdefined(IV, I);
return;
}
@@ -1486,7 +1486,7 @@ bool IPSCCP::runOnModule(Module &M) {
hash_map<Value*, LatticeVal> &Values = Solver.getValueMapping();
for (Module::iterator F = M.begin(), E = M.end(); F != E; ++F)
if (!F->hasInternalLinkage() || AddressIsTaken(F)) {
- if (!F->isExternal())
+ if (!F->isDeclaration())
Solver.MarkBlockExecutable(F->begin());
for (Function::arg_iterator AI = F->arg_begin(), E = F->arg_end();
AI != E; ++AI)
diff --git a/lib/Transforms/Utils/CloneModule.cpp b/lib/Transforms/Utils/CloneModule.cpp
index 70669a8ee3..a4460fa69b 100644
--- a/lib/Transforms/Utils/CloneModule.cpp
+++ b/lib/Transforms/Utils/CloneModule.cpp
@@ -87,7 +87,7 @@ Module *llvm::CloneModule(const Module *M, std::map<const Value*, Value*> &Value
//
for (Module::const_iterator I = M->begin(), E = M->end(); I != E; ++I) {
Function *F = cast<Function>(ValueMap[I]);
- if (!I->isExternal()) {
+ if (!I->isDeclaration()) {
Function::arg_iterator DestI = F->arg_begin();
for (Function::const_arg_iterator J = I->arg_begin(); J != I->arg_end();
++J) {
diff --git a/lib/Transforms/Utils/InlineFunction.cpp b/lib/Transforms/Utils/InlineFunction.cpp
index 83cdfb80c1..f4b1331c0f 100644
--- a/lib/Transforms/Utils/InlineFunction.cpp
+++ b/lib/Transforms/Utils/InlineFunction.cpp
@@ -184,7 +184,7 @@ bool llvm::InlineFunction(CallSite CS, CallGraph *CG) {
const Function *CalledFunc = CS.getCalledFunction();
if (CalledFunc == 0 || // Can't inline external function or indirect
- CalledFunc->isExternal() || // call, or call to a vararg function!
+ CalledFunc->isDeclaration() || // call, or call to a vararg function!
CalledFunc->getFunctionType()->isVarArg()) return false;