Skip to content

Commit

Permalink
Add a couple of assertions to the load combine code introduced by r28…
Browse files Browse the repository at this point in the history
…9538

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@289646 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
arpilipe committed Dec 14, 2016
1 parent d9de836 commit 1452ff9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/CodeGen/SelectionDAG/DAGCombiner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down

0 comments on commit 1452ff9

Please sign in to comment.