[llvm-commits] CVS: llvm/lib/Transforms/IPO/FunctionResolution.cpp
Chris Lattner
lattner at cs.uiuc.edu
Thu Aug 19 17:30:51 PDT 2004
Changes in directory llvm/lib/Transforms/IPO:
FunctionResolution.cpp updated: 1.50 -> 1.51
---
Log message:
If we are linking two global variables and they have the same size, do not
spew warnings, even if the types don't match.
---
Diffs of the changes: (+9 -8)
Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.50 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.51
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.50 Thu Jul 29 12:28:42 2004
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp Thu Aug 19 19:30:39 2004
@@ -236,14 +236,15 @@
// 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) {
More information about the llvm-commits
mailing list