summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2004-08-20 00:30:39 +0000
committerChris Lattner <sabre@nondot.org>2004-08-20 00:30:39 +0000
commit14c198d09ac02617472ada158d541e38f2a59cd9 (patch)
treecfe3d64c29583162a2547a7c95d8364f2f515731 /llvm/lib
parent8f129563277ac6c63264d8b78372f9cdb4b127ac (diff)
downloadbcm5719-llvm-14c198d09ac02617472ada158d541e38f2a59cd9.tar.gz
bcm5719-llvm-14c198d09ac02617472ada158d541e38f2a59cd9.zip
If we are linking two global variables and they have the same size, do not
spew warnings, even if the types don't match. llvm-svn: 15933
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/IPO/FunctionResolution.cpp17
1 files changed, 9 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/IPO/FunctionResolution.cpp b/llvm/lib/Transforms/IPO/FunctionResolution.cpp
index 9cf26b61926..8403226ba38 100644
--- a/llvm/lib/Transforms/IPO/FunctionResolution.cpp
+++ b/llvm/lib/Transforms/IPO/FunctionResolution.cpp
@@ -236,14 +236,15 @@ static bool ProcessGlobalsWithSameName(Module &M, TargetData &TD,
// size of 0, and the concrete global is an array with a real size, don't
// warn. This occurs due to declaring 'extern int A[];'.
if (GlobalVariable *ConcreteGV = dyn_cast<GlobalVariable>(Concrete))
- if (GlobalVariable *OtherGV = dyn_cast<GlobalVariable>(Other))
- if (const ArrayType *OtherAT =
- dyn_cast<ArrayType>(OtherGV->getType()->getElementType()))
- if (const ArrayType *ConcreteAT =
- dyn_cast<ArrayType>(ConcreteGV->getType()->getElementType()))
- if (OtherAT->getElementType() == ConcreteAT->getElementType() &&
- OtherAT->getNumElements() == 0)
- DontPrintWarning = true;
+ if (GlobalVariable *OtherGV = dyn_cast<GlobalVariable>(Other)) {
+ const Type *CTy = ConcreteGV->getType();
+ const Type *OTy = OtherGV->getType();
+
+ if (CTy->isSized())
+ if (!OTy->isSized() || !TD.getTypeSize(OTy) ||
+ TD.getTypeSize(OTy) == TD.getTypeSize(CTy))
+ DontPrintWarning = true;
+ }
}
if (!DontPrintWarning) {
OpenPOWER on IntegriCloud