Issue |
150050
|
Summary |
[DirectX] DXILDataScalarization.cpp is leaving LLVM IR in a broken state where globals are deleted when they still have const uses.
|
Labels |
backend:DirectX
|
Assignees |
farzonl
|
Reporter |
farzonl
|
This bug is a result of `DXILDataScalarization.cpp` not consider that geps could be const expressions of other geps. That means we do not walk const _expression_ GEPs so we never replace the global with its newly scalarized form
```hlsl
groupshared uint4 aTile[10][10];
[numthreads(1, 1, 1)]
void CSMain() {
uint4 aFragPacked = aTile[1][2];
}
```
```llvm
; ModuleID = '../crash.hlsl'
source_filename = "../crash.hlsl"
target datalayout = "e-m:e-p:32:32-i1:32-i8:8-i16:16-i32:32-i64:64-f16:16-f32:32-f64:64-n8:16:32:64"
target triple = "dxilv1.4-pc-shadermodel6.4-compute"
@aTile = hidden addrspace(3) global [10 x [10 x <4 x i32>]] zeroinitializer, align 16
; Function Attrs: convergent noinline norecurse optnone
define void @CSMain() #0 {
entry:
%aFragPacked.i = alloca <4 x i32>, align 16
%0 = load <4 x i32>, ptr addrspace(3) getelementptr inbounds ([10 x <4 x i32>], ptr addrspace(3) getelementptr inbounds ([10 x [10 x <4 x i32>]], ptr addrspace(3) @aTile, i32 0, i32 1), i32 0, i32 2), align 16
store <4 x i32> %0, ptr %aFragPacked.i, align 16
ret void
}
attributes #0 = { convergent noinline norecurse optnone "approx-func-fp-math"="true" "hlsl.numthreads"="1,1,1" "hlsl.shader"="compute" "no-infs-fp-math"="true" "no-nans-fp-math"="true" "no-signed-zeros-fp-math"="true" "no-trapping-math"="true" "stack-protector-buffer-size"="8" }
!llvm.module.flags = !{!0, !1}
!dx.valver = !{!2}
!llvm.ident = !{!3}
!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 1, !"dx.nativelowprec", i32 1}
!2 = !{i32 1, i32 8}
!3 = !{!"clang version 21.0.0git (https://github.com/llvm/llvm-project.git 3d6aac31fcb5f7a988be5e484e44bdc9033265c5)"}
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs