[llvm] 95969c5 - [IR] MatrixBuilder - CreateIndexAssumption - fix unused variable warning on NDEBUG builds
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Mar 9 04:03:06 PST 2022
Author: Simon Pilgrim
Date: 2022-03-09T12:02:53Z
New Revision: 95969c5dbd5bc22a8c64ef77b3ddc49050fc3915
URL: https://github.com/llvm/llvm-project/commit/95969c5dbd5bc22a8c64ef77b3ddc49050fc3915
DIFF: https://github.com/llvm/llvm-project/commit/95969c5dbd5bc22a8c64ef77b3ddc49050fc3915.diff
LOG: [IR] MatrixBuilder - CreateIndexAssumption - fix unused variable warning on NDEBUG builds
Added:
Modified:
llvm/include/llvm/IR/MatrixBuilder.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/IR/MatrixBuilder.h b/llvm/include/llvm/IR/MatrixBuilder.h
index c2f5c4eab8fac..dbf2cfb7c5e96 100644
--- a/llvm/include/llvm/IR/MatrixBuilder.h
+++ b/llvm/include/llvm/IR/MatrixBuilder.h
@@ -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);
}
@@ -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);
More information about the llvm-commits
mailing list