[clang] [NFC][SemaHLSL] Remove check dependent on non-deterministic order (PR #148649)

Finn Plummer via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 14 08:30:26 PDT 2025


https://github.com/inbelic updated https://github.com/llvm/llvm-project/pull/148649

>From ad3211d057b106bd713374369d567d0c9f08459f Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Mon, 14 Jul 2025 15:17:53 +0000
Subject: [PATCH 1/2] [NFC][SemaHLSL] Remove check dependent on
 non-deterministic order

- when there are duplicate `RangeInfo`s created and we will attempt to
`llvm::sort` or `llvm::stable_sort` them, it does not appear
deterministic in which order they will be sorted (because they are
equivalent)

- when `DLLVM_ENABLE_EXSTENSIVE_CHECKS` is enabled, it appears to deal
with this tie-breaker sorting the list differently than when it is not
enabled, this causes one of the test cases to fail because the
diagnostic is produced, not in a different order, but with a different
identical root element

- functionally this makes no difference to the diagnostic being
produced, so we will remove the check that it is that specific element
in the test

This should resolve the build issues reported:
---
 .../RootSignature-resource-ranges-err.hlsl      | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl b/clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl
index 47c06d3fd6381..bac41d13dd6be 100644
--- a/clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl
+++ b/clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl
@@ -112,21 +112,12 @@ void bad_root_signature_14() {}
 // CHECK: [[@LINE-2]]:13: note: expanded from macro 'DuplicatesRootSignature'
 // CHECK-NEXT: [[@LINE-3]] |   "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
 // CHECK-NEXT:             |             ^
-// CHECK: [[@LINE-5]]:4: note: expanded from macro 'DuplicatesRootSignature'
+// CHECK: [[@LINE-5]]:22: note: expanded from macro 'DuplicatesRootSignature'
 // CHECK-NEXT: [[@LINE-6]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
-// CHECK-NEXT:             |     ^
-// CHECK: [[@LINE-8]]:22: note: expanded from macro 'DuplicatesRootSignature'
-// CHECK-NEXT: [[@LINE-9]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
 // CHECK-NEXT:             |                       ^
-// CHECK: [[@LINE-11]]:4: note: expanded from macro 'DuplicatesRootSignature'
-// CHECK-NEXT: [[@LINE-12]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
-// CHECK-NEXT:              |     ^
-// CHECK: [[@LINE-14]]:47: note: expanded from macro 'DuplicatesRootSignature'
-// CHECK-NEXT: [[@LINE-15]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
-// CHECK-NEXT:              |                                                ^
-// CHECK: [[@LINE-17]]:4: note: expanded from macro 'DuplicatesRootSignature'
-// CHECK-NEXT: [[@LINE-18]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
-// CHECK-NEXT:              |     ^
+// CHECK: [[@LINE-8]]:47: note: expanded from macro 'DuplicatesRootSignature'
+// CHECK-NEXT: [[@LINE-9]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
+// CHECK-NEXT:             |                                                ^
 
 // expected-error at +6 {{resource ranges b[0;0] and b[0;0] overlap within space = 0 and visibility = All}}
 // expected-note at +5 {{overlapping resource range here}}

>From e47d9bd4db2416689ed92b8d93befb48e4162218 Mon Sep 17 00:00:00 2001
From: Finn Plummer <canadienfinn at gmail.com>
Date: Mon, 14 Jul 2025 15:30:13 +0000
Subject: [PATCH 2/2] nfc, self-review: we can make it slightly stricter

---
 .../SemaHLSL/RootSignature-resource-ranges-err.hlsl | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl b/clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl
index bac41d13dd6be..02b7c661ae022 100644
--- a/clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl
+++ b/clang/test/SemaHLSL/RootSignature-resource-ranges-err.hlsl
@@ -109,14 +109,17 @@ void bad_root_signature_14() {}
 #define DuplicatesRootSignature \
   "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
 
-// CHECK: [[@LINE-2]]:13: note: expanded from macro 'DuplicatesRootSignature'
+// CHECK: [[@LINE-2]]:4: note: expanded from macro 'DuplicatesRootSignature'
 // CHECK-NEXT: [[@LINE-3]] |   "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
+// CHECK-NEXT:             |    ^
+// CHECK: [[@LINE-5]]:13: note: expanded from macro 'DuplicatesRootSignature'
+// CHECK-NEXT: [[@LINE-6]] |   "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
 // CHECK-NEXT:             |             ^
-// CHECK: [[@LINE-5]]:22: note: expanded from macro 'DuplicatesRootSignature'
-// CHECK-NEXT: [[@LINE-6]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
-// CHECK-NEXT:             |                       ^
-// CHECK: [[@LINE-8]]:47: note: expanded from macro 'DuplicatesRootSignature'
+// CHECK: [[@LINE-8]]:22: note: expanded from macro 'DuplicatesRootSignature'
 // CHECK-NEXT: [[@LINE-9]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
+// CHECK-NEXT:             |                       ^
+// CHECK: [[@LINE-11]]:47: note: expanded from macro 'DuplicatesRootSignature'
+// CHECK-NEXT: [[@LINE-12]] |    "CBV(b0), CBV(b0), CBV(b0), DescriptorTable(CBV(b0, numDescriptors = 2))"
 // CHECK-NEXT:             |                                                ^
 
 // expected-error at +6 {{resource ranges b[0;0] and b[0;0] overlap within space = 0 and visibility = All}}



More information about the cfe-commits mailing list