stage2: Miscellaneous fixes to vector arithmetic and copy elision
- [Sema] Changes array initialization to scan for stores the same way struct init does
- [Sema/Value] Renames
compare(and family) tocompareAll(etc.), and fixes lots of places where the wrong predicate for vectors was used - [Sema] If vector arithmetic yields a compile-time-known constant, make sure it's a vector
- ~~[Liveness] Add a peephole optimization for safety checks to Liveness, for copy/load elision~~
- [LLVM] Fix up load elision to account for "byref pass-through" consumers like
.array_elem_val, etc. which do not make copies
P.S. As @Vexu pointed out to me, we still need a way to ensure that if, e.g., foo.arr[x][y].z performs a copy, it only copies the target object rather than all of foo. This is (usually) handled correctly already when the result is a non-by-ref type, but it needs some tightening, esp. for by-ref types.
Resolves #13064, Resolves #13065, Resolves #13069 + others mentioned in the commits
Could you rebase against master branch please?
~~I think cef0f11 might be exposing a bug in how we've been handling by_ref types in .struct_field_val~~
~~If I can't fix the issue, I'll have to revert this and make field/element accesses for unions and arrays perform a copy as well (meaning performance gets worse, unfortunately).~~
~~I'm going to convert this to a draft while I investigate.~~
All resolved now
That Liveness change looks like it might deserve its own PR, I'd like to take a close look at it.
That Liveness change looks like it might deserve its own PR, I'd like to take a close look at it.
Aye aye, I'll spin one up
Made this dependent on https://github.com/ziglang/zig/pull/13221, which resolves the prior CI failures. CI passing is unfortunately still blocked on https://github.com/ziglang/zig/issues/13232, which is present on master but seems to be passing by the luck of the (alignment) draw ♠️
Going to revisit this now that #13221 has landed.
Is there an ETA on this? I was surprised these fixes did not go into 0.10.
I like that approach! Seems like a nice improvement.
My sis got hitched last weekend 🎉 so I haven't gotten to fix this one up, but I should have it ready for review in a day or two.
Thanks @topolarity !