# stage2 llvm: Elide more loads · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/a2f4de1663f815ae8c202ba6a8c68b0658b7d23f)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: a2f4de1663f815ae8c202ba6a8c68b0658b7d23f

Requested commit: a2f4de1663f815ae8c202ba6a8c68b0658b7d23f

Commit: a2f4de1663f815ae8c202ba6a8c68b0658b7d23f

Tree: e900f62b506072b35e8d4d106c7948ee6977879c

Author: Cody Tapscott

Committer: Cody Tapscott

## Message

```
stage2 llvm: Elide more loads

Adds optimizations for by-ref types to:
  - .struct_field_val
  - .slice_elem_val
  - .ptr_elem_val

I would have expected LLVM to be able to optimize away these
temporaries since we don't leak pointers to them and they are fed
straight from def to use, but empirically it does not.

Resolves https://github.com/ziglang/zig/issues/12713
Resolves https://github.com/ziglang/zig/issues/12638

```

## Parents

- [8f3880074fb76871d9a4f35d1f72d0304ac5b404](https://git.cafe/gitcafe/zig/commit/8f3880074fb76871d9a4f35d1f72d0304ac5b404?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/a2f4de1663f815ae8c202ba6a8c68b0658b7d23f?format=markdown)
