Skip to content

Commit 40d30f3

Browse files
committed
When creating load assert that range MD and load type are consistent
Signed-off-by: John Lu <[email protected]>
1 parent 1c79f0f commit 40d30f3

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9176,6 +9176,12 @@ SDValue SelectionDAG::getLoad(ISD::MemIndexedMode AM, ISD::LoadExtType ExtType,
91769176
"Cannot use an ext load to change the number of vector elements!");
91779177
}
91789178

9179+
assert((!MMO->getRanges() ||
9180+
(mdconst::extract<ConstantInt>(MMO->getRanges()->getOperand(0))
9181+
->getBitWidth() == MemVT.getScalarSizeInBits() &&
9182+
MemVT.isInteger())) &&
9183+
"Range metadata and load type must match!");
9184+
91799185
bool Indexed = AM != ISD::UNINDEXED;
91809186
assert((Indexed || Offset.isUndef()) && "Unindexed load with an offset!");
91819187

0 commit comments

Comments
 (0)