[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalOpt.cpp SimplifyLibCalls.cpp
Anton Korobeynikov
asl at math.spbu.ru
Thu Sep 14 11:24:05 PDT 2006
Changes in directory llvm/lib/Transforms/IPO:
GlobalOpt.cpp updated: 1.63 -> 1.64
SimplifyLibCalls.cpp updated: 1.68 -> 1.69
---
Log message:
Adding dllimport, dllexport and external weak linkage types.
DLL* linkages got full (I hope) codegeneration support in C & both x86
assembler backends.
External weak linkage added for future use, we don't provide any
codegeneration, etc. support for it.
---
Diffs of the changes: (+6 -4)
GlobalOpt.cpp | 4 ++--
SimplifyLibCalls.cpp | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)
Index: llvm/lib/Transforms/IPO/GlobalOpt.cpp
diff -u llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.63 llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.64
--- llvm/lib/Transforms/IPO/GlobalOpt.cpp:1.63 Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/IPO/GlobalOpt.cpp Thu Sep 14 13:23:27 2006
@@ -1245,7 +1245,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 linkage.
+ return false; // do not allow weak/linkonce/dllimport/dllexport linkage.
return !GV->isExternal(); // reject external globals.
}
if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C))
@@ -1254,7 +1254,7 @@
isa<GlobalVariable>(CE->getOperand(0))) {
GlobalVariable *GV = cast<GlobalVariable>(CE->getOperand(0));
if (!GV->hasExternalLinkage() && !GV->hasInternalLinkage())
- return false; // do not allow weak/linkonce linkage.
+ return false; // do not allow weak/linkonce/dllimport/dllexport linkage.
return GV->hasInitializer() &&
ConstantFoldLoadThroughGEPConstantExpr(GV->getInitializer(), CE);
}
Index: llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp
diff -u llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.68 llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.69
--- llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp:1.68 Sun Aug 27 17:42:52 2006
+++ llvm/lib/Transforms/IPO/SimplifyLibCalls.cpp Thu Sep 14 13:23:27 2006
@@ -178,8 +178,10 @@
// All the "well-known" functions are external and have external linkage
// 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 linkage and non-empty uses.
- if (!FI->isExternal() || !FI->hasExternalLinkage() || FI->use_empty())
+ // have external or dllimport linkage and non-empty uses.
+ if (!FI->isExternal() ||
+ !(FI->hasExternalLinkage() || FI->hasDLLImportLinkage()) ||
+ FI->use_empty())
continue;
// Get the optimization class that pertains to this function
More information about the llvm-commits
mailing list