Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HLSL] Fix for build break introduced by #85662 #85839

Merged
merged 1 commit into from
Mar 19, 2024

Conversation

farzonl
Copy link
Member

@farzonl farzonl commented Mar 19, 2024

This change fixes a test case failure caused by pr #85662

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Mar 19, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Mar 19, 2024

@llvm/pr-subscribers-clang

Author: Farzon Lotfi (farzonl)

Changes

This change fixes a test case failure caused by pr #85662


Full diff: https://github.com/llvm/llvm-project/pull/85839.diff

2 Files Affected:

  • (modified) clang/include/clang/AST/Type.h (+5)
  • (modified) clang/lib/Sema/SemaChecking.cpp (+2-4)
diff --git a/clang/include/clang/AST/Type.h b/clang/include/clang/AST/Type.h
index 10916053cdfbf5..be18535e3e4c8c 100644
--- a/clang/include/clang/AST/Type.h
+++ b/clang/include/clang/AST/Type.h
@@ -2245,6 +2245,7 @@ class alignas(TypeAlignment) Type : public ExtQualsTypeCommonBase {
   bool isHalfType() const;         // OpenCL 6.1.1.1, NEON (IEEE 754-2008 half)
   bool isFloat16Type() const;      // C11 extension ISO/IEC TS 18661
   bool isFloat32Type() const;
+  bool isDoubleType() const;
   bool isBFloat16Type() const;
   bool isFloat128Type() const;
   bool isIbm128Type() const;
@@ -7457,6 +7458,10 @@ inline bool Type::isFloat32Type() const {
   return isSpecificBuiltinType(BuiltinType::Float);
 }
 
+inline bool Type::isDoubleType() const {
+  return isSpecificBuiltinType(BuiltinType::Double);
+}
+
 inline bool Type::isBFloat16Type() const {
   return isSpecificBuiltinType(BuiltinType::BFloat16);
 }
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index f9112a29027acd..ef3ab16ba29b41 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -5486,10 +5486,8 @@ bool CheckFloatOrHalfRepresentations(Sema *S, CallExpr *TheCall) {
 
 bool CheckNoDoubleVectors(Sema *S, CallExpr *TheCall) {
   auto checkDoubleVector = [](clang::QualType PassedType) -> bool {
-    if (const auto *VecTy = dyn_cast<VectorType>(PassedType)) {
-      clang::QualType BaseType = VecTy->getElementType();
-      return !BaseType->isHalfType() && !BaseType->isFloat32Type();
-    }
+    if (const auto *VecTy = PassedType->getAs<VectorType>())
+      return VecTy->getElementType()->isDoubleType();
     return false;
   };
   return CheckArgsTypesAreCorrect(S, TheCall, S->Context.FloatTy,

@bogner bogner merged commit 3ff67d8 into llvm:main Mar 19, 2024
6 of 7 checks passed
@bogner
Copy link
Contributor

bogner commented Mar 19, 2024

I've gone ahead and merged this since it fixes the build break. In the future when you see a build break, please just revert the breaking change to get the build green again and then work on the fixed patch. It's unfair to others using trunk to have to wait on a fix for an obvious build break.

@farzonl
Copy link
Member Author

farzonl commented Mar 19, 2024

I'm confident this change fixes the build break:

python ../debug-llvm-build/bin/llvm-lit -sv clang/test/SemaHLSL/
llvm-lit: /mnt/DevDrive/projects/llvm-project/llvm/utils/lit/lit/llvm/config.py:502: note: using clang: /mnt/DevDrive/projects/debug-llvm-build/bin/clang

Testing Time: 0.67s

Total Discovered Tests: 43
  Passed           : 42 (97.67%)
  Expectedly Failed:  1 (2.33%)

python ../debug-llvm-build/bin/llvm-lit -sv clang/test/CodeGenHLSL/
llvm-lit: /mnt/DevDrive/projects/llvm-project/llvm/utils/lit/lit/llvm/config.py:502: note: using clang: /mnt/DevDrive/projects/debug-llvm-build/bin/clang

Testing Time: 0.88s

Total Discovered Tests: 63
  Passed: 63 (100.00%)

python ../debug-llvm-build/bin/llvm-lit -sv clang/test/Sema
llvm-lit: /mnt/DevDrive/projects/llvm-project/llvm/utils/lit/lit/llvm/config.py:502: note: using clang: /mnt/DevDrive/projects/debug-llvm-build/bin/clang

Testing Time: 26.09s

Total Discovered Tests: 979
  Unsupported:   1 (0.10%)
  Passed     : 978 (99.90%)

@farzonl
Copy link
Member Author

farzonl commented Mar 19, 2024

builds should be back to green all 51 checks passed: 3ff67d8

@farzonl farzonl deleted the build-break-fix-pr85662 branch March 19, 2024 21:04
chencha3 pushed a commit to chencha3/llvm-project that referenced this pull request Mar 23, 2024
This change fixes a test case failure caused by pr llvm#85662
qiaojbao pushed a commit to GPUOpen-Drivers/llvm-project that referenced this pull request May 15, 2024
…383d383cb

Local branch amd-gfx fb6383d Merged main:d9c31ee9568277e4303715736b40925e41503596 into amd-gfx:a79be10fda42
Remote branch main 3ff67d8 [HLSL] Fix for build break introduced by llvm#85662 (llvm#85839)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants