[clang] 3692995 - [CodeGen] Fix warnings

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 3 10:47:33 PDT 2024


Author: Kazu Hirata
Date: 2024-10-03T10:47:26-07:00
New Revision: 36929955f5f0ff9b7ab1314dcbbb374d52f18a42

URL: https://github.com/llvm/llvm-project/commit/36929955f5f0ff9b7ab1314dcbbb374d52f18a42
DIFF: https://github.com/llvm/llvm-project/commit/36929955f5f0ff9b7ab1314dcbbb374d52f18a42.diff

LOG: [CodeGen] Fix warnings

This patch fixes:

  clang/lib/CodeGen/CGBuiltin.cpp:18677:11: error: unused variable
  'XVecTy1' [-Werror,-Wunused-variable]

  clang/lib/CodeGen/CGBuiltin.cpp:18678:11: error: unused variable
  'XVecTy2' [-Werror,-Wunused-variable]

Added: 
    

Modified: 
    clang/lib/CodeGen/CGBuiltin.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/CodeGen/CGBuiltin.cpp b/clang/lib/CodeGen/CGBuiltin.cpp
index 01d80c1e10f8c8..43700ea9dd3cfd 100644
--- a/clang/lib/CodeGen/CGBuiltin.cpp
+++ b/clang/lib/CodeGen/CGBuiltin.cpp
@@ -18674,10 +18674,10 @@ Value *CodeGenFunction::EmitHLSLBuiltinExpr(unsigned BuiltinID,
            E->getArg(1)->getType()->hasFloatingRepresentation() &&
            "cross operands must have a float representation");
     // make sure each vector has exactly 3 elements
-    auto *XVecTy1 = E->getArg(0)->getType()->getAs<VectorType>();
-    auto *XVecTy2 = E->getArg(1)->getType()->getAs<VectorType>();
-    assert(XVecTy1->getNumElements() == 3 && XVecTy2->getNumElements() == 3 &&
-           "input vectors must have 3 elements each");
+    assert(
+        E->getArg(0)->getType()->getAs<VectorType>()->getNumElements() == 3 &&
+        E->getArg(1)->getType()->getAs<VectorType>()->getNumElements() == 3 &&
+        "input vectors must have 3 elements each");
     return Builder.CreateIntrinsic(
         /*ReturnType=*/Op0->getType(), CGM.getHLSLRuntime().getCrossIntrinsic(),
         ArrayRef<Value *>{Op0, Op1}, nullptr, "hlsl.cross");


        


More information about the cfe-commits mailing list