[clang] [HLSL][NFC] Fix fragile tests (PR #241625)

via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 17:58:20 PST 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Helena Kotas (hekota)

<details>
<summary>Changes</summary>

- Remove unstable attribute-group number
- Add anchor for function declaration to scope the checks to the intended function.

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


3 Files Affected:

- (modified) clang/test/CodeGenHLSL/builtins/f16tof32-builtin.hlsl (+1-1) 
- (modified) clang/test/CodeGenHLSL/builtins/f16tof32.hlsl (+1-1) 
- (modified) clang/test/SemaHLSL/TruncationOverloadResolution.hlsl (+2) 


``````````diff
diff --git a/clang/test/CodeGenHLSL/builtins/f16tof32-builtin.hlsl b/clang/test/CodeGenHLSL/builtins/f16tof32-builtin.hlsl
index 7fb7026797cde..f48e87645bfbd 100644
--- a/clang/test/CodeGenHLSL/builtins/f16tof32-builtin.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/f16tof32-builtin.hlsl
@@ -14,7 +14,7 @@
 // SPIRV: %[[U1:[0-9]+]] = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.spv.unpackhalf2x16.v2f32(i32 %[[#]])
 // SPIRV: %[[R1:[0-9]+]] = extractelement <2 x float> %[[U1]], i64 0
 // SPIRV: ret float %[[R1]]
-// SPIRV: declare <2 x float> @llvm.spv.unpackhalf2x16.v2f32(i32) #2
+// SPIRV: declare <2 x float> @llvm.spv.unpackhalf2x16.v2f32(i32)
 float test_scalar(uint p0) { return __builtin_hlsl_elementwise_f16tof32(p0); }
 
 // CHECK: define hidden noundef nofpclass(nan inf) <2 x float>
diff --git a/clang/test/CodeGenHLSL/builtins/f16tof32.hlsl b/clang/test/CodeGenHLSL/builtins/f16tof32.hlsl
index d2504b3628ee2..73cd28bac4721 100644
--- a/clang/test/CodeGenHLSL/builtins/f16tof32.hlsl
+++ b/clang/test/CodeGenHLSL/builtins/f16tof32.hlsl
@@ -14,7 +14,7 @@
 // SPIRV: %[[U1:[0-9]+]] = call reassoc nnan ninf nsz arcp afn <2 x float> @llvm.spv.unpackhalf2x16.v2f32(i32 %[[#]])
 // SPIRV: %[[R1:[0-9]+]] = extractelement <2 x float> %[[U1]], i64 0
 // SPIRV: ret float %[[R1]]
-// SPIRV: declare <2 x float> @llvm.spv.unpackhalf2x16.v2f32(i32) #2
+// SPIRV: declare <2 x float> @llvm.spv.unpackhalf2x16.v2f32(i32)
 float test_scalar(uint p0) { return f16tof32(p0); }
 
 // CHECK: define hidden noundef nofpclass(nan inf) <2 x float>
diff --git a/clang/test/SemaHLSL/TruncationOverloadResolution.hlsl b/clang/test/SemaHLSL/TruncationOverloadResolution.hlsl
index f6f5c1f261ed9..c7e3542b8a0d9 100644
--- a/clang/test/SemaHLSL/TruncationOverloadResolution.hlsl
+++ b/clang/test/SemaHLSL/TruncationOverloadResolution.hlsl
@@ -7,6 +7,7 @@ void Half4Float2(float2 D);
 void Half4Float2(half4 D);
 
 void Case1(float4 F, double4 D) {
+  // CHECK: FunctionDecl {{.*}} Case1
   // CHECK: CallExpr {{.*}} 'void'
   // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(half4)' <FunctionToPointerDecay>
   // CHECK-NEXT: DeclRefExpr {{.*}} 'void (half4)' lvalue Function {{.*}} 'Half4Float2' 'void (half4)'
@@ -18,6 +19,7 @@ void Half2Double2(double2 D);
 void Half2Double2(half2 H);
 
 void Case2(float4 F) {
+  // CHECK: FunctionDecl {{.*}} Case2
   // CHECK: CallExpr {{.*}} 'void'
   // CHECK-NEXT: ImplicitCastExpr {{.*}} 'void (*)(double2)' <FunctionToPointerDecay>
   // CHECK-NEXT: DeclRefExpr {{.*}} 'void (double2)' lvalue Function {{.*}} 'Half2Double2' 'void (double2)'

``````````

</details>


https://github.com/llvm/llvm-project/pull/241625


More information about the cfe-commits mailing list