summaryrefslogtreecommitdiffstats
path: root/llvm/lib/IR/DataLayout.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-02-26 17:02:08 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-02-26 17:02:08 +0000
commitae593f1563e615ded29b4f3d7ec0635492bc2db1 (patch)
treeee7ec61520c910f741741abcf83fd2c2b72ead7c /llvm/lib/IR/DataLayout.cpp
parent667fcb839eefb2f12ea1d7216189759f0bddd33e (diff)
downloadbcm5719-llvm-ae593f1563e615ded29b4f3d7ec0635492bc2db1.tar.gz
bcm5719-llvm-ae593f1563e615ded29b4f3d7ec0635492bc2db1.zip
Compare DataLayout by Value, not by pointer.
This fixes spurious warnings in llvm-link about the datalayout not matching. Thanks to Zalman Stern for reporting the bug! llvm-svn: 202276
Diffstat (limited to 'llvm/lib/IR/DataLayout.cpp')
-rw-r--r--llvm/lib/IR/DataLayout.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/IR/DataLayout.cpp b/llvm/lib/IR/DataLayout.cpp
index 7089b7b85ff..162f3d3ac37 100644
--- a/llvm/lib/IR/DataLayout.cpp
+++ b/llvm/lib/IR/DataLayout.cpp
@@ -354,6 +354,16 @@ DataLayout::DataLayout(const Module *M) : LayoutMap(0) {
reset("");
}
+bool DataLayout::operator==(const DataLayout &Other) const {
+ bool Ret = LittleEndian == Other.LittleEndian &&
+ StackNaturalAlign == Other.StackNaturalAlign &&
+ ManglingMode == Other.ManglingMode &&
+ LegalIntWidths == Other.LegalIntWidths &&
+ Alignments == Other.Alignments && Pointers == Pointers;
+ assert(Ret == (getStringRepresentation() == Other.getStringRepresentation()));
+ return Ret;
+}
+
void
DataLayout::setAlignment(AlignTypeEnum align_type, unsigned abi_align,
unsigned pref_align, uint32_t bit_width) {
OpenPOWER on IntegriCloud