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
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to