From: Artur Pilipenko Date: Wed, 14 Dec 2016 11:55:47 +0000 (+0000) Subject: Add a couple of assertions to the load combine code introduced by r289538 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1452ff9efc64fb0cfc08b3899d9b864c7320e748;p=llvm Add a couple of assertions to the load combine code introduced by r289538 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289646 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp b/lib/CodeGen/SelectionDAG/DAGCombiner.cpp index 20a6477e210..394a363d6b8 100644 --- a/lib/CodeGen/SelectionDAG/DAGCombiner.cpp +++ b/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