Skip to content

Commit

Permalink
[IR] MatrixBuilder - CreateIndexAssumption - fix unused variable warn…
Browse files Browse the repository at this point in the history
…ing on NDEBUG builds
  • Loading branch information
RKSimon committed Mar 9, 2022
1 parent 506a91c commit 95969c5
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions llvm/include/llvm/IR/MatrixBuilder.h
Expand Up @@ -230,12 +230,11 @@ class MatrixBuilder {
/// Create an assumption that \p Idx is less than \p NumElements.
void CreateIndexAssumption(Value *Idx, unsigned NumElements,
Twine const &Name = "") {

Value *NumElts =
B.getIntN(Idx->getType()->getScalarSizeInBits(), NumElements);
auto *Cmp = B.CreateICmpULT(Idx, NumElts);
if (auto *ConstCond = dyn_cast<ConstantInt>(Cmp))
assert(ConstCond->isOne() && "Index must be valid!");
if (isa<ConstantInt>(Cmp))
assert(cast<ConstantInt>(Cmp)->isOne() && "Index must be valid!");
else
B.CreateAssumption(Cmp);
}
Expand All @@ -244,7 +243,6 @@ class MatrixBuilder {
/// a matrix with \p NumRows embedded in a vector.
Value *CreateIndex(Value *RowIdx, Value *ColumnIdx, unsigned NumRows,
Twine const &Name = "") {

unsigned MaxWidth = std::max(RowIdx->getType()->getScalarSizeInBits(),
ColumnIdx->getType()->getScalarSizeInBits());
Type *IntTy = IntegerType::get(RowIdx->getType()->getContext(), MaxWidth);
Expand Down

0 comments on commit 95969c5

Please sign in to comment.