clangir icon indicating copy to clipboard operation
clangir copied to clipboard

Leverage `#cir.zero` in large constant strings initializers

Open sitio-couto opened this issue 1 year ago • 1 comments

The initializer for the null strings should leverage #cir.zero in some way. The reason for this is to improve performance when facing large zero/prefix-initialized strings. For example:

struct {
  char r[100000];
  char g[100000];
  char b[100000];
} image = {"", "1234", "\0"};

The resulting CIR code for this example consists of three #cir.const_arrays with thousands \00 hexadecimal chars each, making them unnecessarily large.

Originally posted by @sitio-couto in https://github.com/llvm/clangir/pull/244#discussion_r1310242571

sitio-couto avatar Aug 30 '23 17:08 sitio-couto

We have trailing_zeros these days, could be use here.

bcardosolopes avatar Apr 23 '24 03:04 bcardosolopes

I am going to take this task

ivanmurashko avatar May 13 '24 19:05 ivanmurashko