You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fixed loading of constant structs by ConstantLoader
constant returns are not allowed, and PostLegalization is expected to
insert a proper constant loading sequence. However, if we return a
constant structure, before this patch the generated sequence looked like
this:
```
ret { <4 x i32> } { <4 x i32> <i32 1, i32 1, i32 1, i32 1> })
```
->
```
%const_val = call { <4 x i32> } @llvm.genx.constanti.s1v4i32(
{ <4 x i32> } { <4 x i32> <i32 1, i32 1, i32 1, i32 1> })
ret %const_val
```
Issue: *genx.constanti* is designed to handle proper vector types, not
aggregates!
This commit introduces the following changes:
1. All constant structures are treated as non-simple constants and
always loaded by loadNonSimpleConstants
2. Undef values are left as is
3. ConstantLoader class must not be used with aggregate types (including
structs).
NOTE_1: In theory, restriction #3 can be relaxed by allowing
ConstantLoader to operate on such types. 2 minor issues are prevent us
from doing that:
I. I haven't observed such cases in practice :).
II. This would require us to handle *undef* values. The resulting code
looks extremely quirky as the constant loader must produce instruction,
not a value.
NOTE_2: This change may not solve all the remaining issues with constant
structures. For example - loadPhiConstants could potentially encounter a
constant struct. If this happens in practice - then we must
relax our restrictions on ConsantLoader (see NOTE_1).
0 commit comments