Issue |
137202
|
Summary |
[DirectX] Legalize i8 allocas
|
Labels |
backend:DirectX
|
Assignees |
|
Reporter |
farzonl
|
We have code like this:
```llvm
%accum.i.flat = alloca [1 x i32], align 4
%i = alloca i8, align 4
store i8 1, ptr %i
%i8.load = load i8, ptr %i
%z = zext i8 %i8.load to i32
%gep = getelementptr i32, ptr %accum.i.flat, i32 0
store i32 %z, ptr %gep, align 4
```
The i8 alloca uses (ie li8 loads/stores) are all illegal in DirectX. The cases that result in an i8 cast to a larger type are ussually a sign something wrongis happening.
What we would want to do is 1 of 2 things.
Detect the cast of i8 to a new type and work our way back to propogate the new type to the loads/stores and eventually the alloca then delete the cast.
OR 2. detect the i8 allocas and follow the data flow down to its first cast to a larger type. Then replaces the alloca and uses of the alloca with the new type.
The potential pit fall to both approaches is an alloca can have uses by ptrs of any size so there maybe uses that are non-i8 uses that coule complicate replacement.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs