summaryrefslogtreecommitdiffstats
path: root/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
diff options
context:
space:
mode:
authorArtur Pilipenko <apilipenko@azulsystems.com>2016-12-14 11:55:47 +0000
committerArtur Pilipenko <apilipenko@azulsystems.com>2016-12-14 11:55:47 +0000
commitf3ee444010a3fe11f1e631a10a6db4bde290b415 (patch)
tree61084fad9036cdffeadc980c65f232476e434d29 /llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
parentcfd1ce6a526a0d66853260a0f0eb777abdd0119b (diff)
downloadbcm5719-llvm-f3ee444010a3fe11f1e631a10a6db4bde290b415.tar.gz
bcm5719-llvm-f3ee444010a3fe11f1e631a10a6db4bde290b415.zip
Add a couple of assertions to the load combine code introduced by r289538
llvm-svn: 289646
Diffstat (limited to 'llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp')
-rw-r--r--llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
index 20a6477e210..394a363d6b8 100644
--- a/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp
@@ -4561,7 +4561,10 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) {
return SDValue();
// Calculate the offset of the current byte from the base address
- unsigned LoadByteWidth = L->getMemoryVT().getSizeInBits() / 8;
+ unsigned LoadBitWidth = L->getMemoryVT().getSizeInBits();
+ assert(LoadBitWidth % 8 == 0 &&
+ "can only analyze providers for individual bytes not bit");
+ unsigned LoadByteWidth = LoadBitWidth / 8;
int64_t MemoryByteOffset =
DAG.getDataLayout().isBigEndian()
? BigEndianByteAt(LoadByteWidth, Bytes[i].ByteOffset)
@@ -4576,6 +4579,7 @@ SDValue DAGCombiner::MatchLoadCombine(SDNode *N) {
Loads.insert(L);
}
assert(Base && "must be set");
+ assert(Loads.size() > 0 && "must be at least one load");
// Check if the bytes of the OR we are looking at match with either big or
// little endian value load
OpenPOWER on IntegriCloud