| Issue |
179951
|
| Summary |
[HLSL][AST] ArrayToPointer decay for array indexing?
|
| Labels |
new issue
|
| Assignees |
|
| Reporter |
Keenuts
|
Hi,
Found this while looking at the SGEP implementation on the frontend.
The following HLSL code:
```cpp
void main() {
uint array[4];
array[2] = 12;
}
```
Yields this AST:
```
| `-BinaryOperator 0x56193b16b770 <line:6:3, col:14> 'uint':'unsigned int' lvalue '='
| |-ArraySubscriptExpr 0x56193b16b718 <col:3, col:10> 'uint':'unsigned int' lvalue
| | |-ImplicitCastExpr 0x56193b16b700 <col:3> 'uint *' <ArrayToPointerDecay>
| | | `-DeclRefExpr 0x56193b16b648 <col:3> 'uint[4]' lvalue Var 0x56193b16b5c8 'array' 'uint[4]'
| | `-IntegerLiteral 0x56193b16b680 <col:9> 'int' 2
| `-ImplicitCastExpr 0x56193b16b758 <col:14> 'uint':'unsigned int' <IntegralCast>
| `-IntegerLiteral 0x56193b16b738 <col:14> 'int' 12
```
Is it by design that we have this `ArrayToPointerDecay` cast? When working on the SGEP emission (see https://github.com/llvm/llvm-project/pull/177332 ), I realized I needed to bypass those when emitting HLSL.
Seems to me this might be an oversight of the behavior we inherit from C/C++ no? Shouldn't we avoid those ArrayToPointer decay in HLSL since we have no pointers?
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs