Issue 139023
Summary [DirectX] Validator is erroring with Internal declaration '.*' is unused
Labels backend:DirectX
Assignees
Reporter farzonl
    Three examples. In all three its happeing on array flattened values.

```
96x error: Internal declaration 'bTile.scalarized.1dim' is unused.
64x error: Internal declaration 'aTile.1dim' is unused.
32x error: Internal declaration 'aTile.scalarized.1dim' is unused.
```

Its curious that there was anything to flatten in these cases since we flatten after optimizations. I suspect these two types were used in a function  that was cleaned up by Finalize Linkage but the global lived on.

looking at:
```bash
clang-dxc DirectML/Product/Shaders/Generated/ConvolutionIntegerFastPathShortGemm4_int_TRUE.hlsl -E CSMain -T cs_6_4  -enable-16bit-types  -O3 -D DXC_COMPILER=1 -D __SHADER_TARGET_MAJOR=6 -D __SHADER_TARGET_MINOR=4 -I DirectML/Product/Shaders/
```

I see these two and they are defined but not used. We should probably delete them if this is the case. 

@aTile.1dim = local_unnamed_addr addrspace(3) global [64 x i32] zeroinitializer, align 4
@bTile.scalarized.1dim = local_unnamed_addr addrspace(3) global [512 x i32] zeroinitializer, align 4

We could add a check for uses to both [DXILDataScalarization.cpp](https://github.com/llvm/llvm-project/blob/c7f350f1428df14e3114977b830ab4dcd3008983/llvm/lib/Target/DirectX/DXILDataScalarization.cpp) and [DXILFlattenArrays.cpp](https://github.com/llvm/llvm-project/blob/c7f350f1428df14e3114977b830ab4dcd3008983/llvm/lib/Target/DirectX/DXILFlattenArrays.cpp). If there are no uses then we just delete and don't do transformations.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to