[clang] adcb17b - [Clang][HLSL] Fix -Wunused-variable
Aiden Grossman via cfe-commits
cfe-commits at lists.llvm.org
Sat Mar 21 13:50:16 PDT 2026
Author: Aiden Grossman
Date: 2026-03-21T20:50:03Z
New Revision: adcb17b47641a1afb1cc694e3ff363fb1cb2a288
URL: https://github.com/llvm/llvm-project/commit/adcb17b47641a1afb1cc694e3ff363fb1cb2a288
DIFF: https://github.com/llvm/llvm-project/commit/adcb17b47641a1afb1cc694e3ff363fb1cb2a288.diff
LOG: [Clang][HLSL] Fix -Wunused-variable
Inline the definition of a variable into an assertion given it has no
other users and no side effects.
Added:
Modified:
clang/lib/CodeGen/CGHLSLBuiltins.cpp
Removed:
################################################################################
diff --git a/clang/lib/CodeGen/CGHLSLBuiltins.cpp b/clang/lib/CodeGen/CGHLSLBuiltins.cpp
index 6aebc22f94f52..eabc2c9d29df8 100644
--- a/clang/lib/CodeGen/CGHLSLBuiltins.cpp
+++ b/clang/lib/CodeGen/CGHLSLBuiltins.cpp
@@ -1143,8 +1143,8 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
auto *MatTy = QTy0->castAs<ConstantMatrixType>();
unsigned Rows = MatTy->getNumRows();
unsigned Cols = MatTy->getNumColumns();
- unsigned N = QTy1->castAs<VectorType>()->getNumElements();
- assert(N == Cols && "vector length must match matrix column count");
+ assert(QTy1->castAs<VectorType>()->getNumElements() == Cols &&
+ "vector length must match matrix column count");
if (IsRowMajor)
Op0 = MB.CreateRowMajorToColumnMajorTransform(Op0, Rows, Cols);
return MB.CreateMatrixMultiply(Op0, Op1, Rows, Cols, 1, "hlsl.mul");
More information about the cfe-commits
mailing list