[llvm-branch-commits] [llvm] [DirectX] Fix resource binding analysis incorrectly removing duplicates (PR #152253)
Justin Bogner via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Wed Aug 6 14:30:29 PDT 2025
bogner wrote:
> This should be testable with a unit test in llvm/unittests/Fronted/HLSLBindingTest.cpp rather than via an assert in DXILPostOptimizationValidation
Something like this should catch it I think:
```c++
TEST(HLSLBindingTest, TestNoOverlapWithDuplicates) {
hlsl::BindingInfoBuilder Builder;
// We add the same binding three times, and just use `nullptr` for the cookie
// so that they should all be uniqued away.
Builder.trackBinding(ResourceClass::SRV, /*Space=*/0, /*LowerBound=*/5,
/*UpperBound=*/5, /*Cookie=*/nullptr);
Builder.trackBinding(ResourceClass::SRV, /*Space=*/0, /*LowerBound=*/5,
/*UpperBound=*/5, /*Cookie=*/nullptr);
Builder.trackBinding(ResourceClass::SRV, /*Space=*/0, /*LowerBound=*/5,
/*UpperBound=*/5, /*Cookie=*/nullptr);
bool HasOverlap;
hlsl::BindingInfo Info = Builder.calculateBindingInfo(HasOverlap);
EXPECT_FALSE(HasOverlap);
}
```
https://github.com/llvm/llvm-project/pull/152253
More information about the llvm-branch-commits
mailing list