[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:19:36 PDT 2025


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

- 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 [here](https://github.com/llvm/llvm-project/pull/147115#issuecomment-3069543491) and [here](https://github.com/llvm/llvm-project/pull/147800#issuecomment-3069797406)

>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] [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}}



More information about the cfe-commits mailing list