Stepan Dyatkovskiy
2012-Jan-20 07:40 UTC
[LLVMdev] How to force the creation of arrays with zeroes?
Hi all. How to force the creation of arrays with zeroes? Or this use-case is not provided? -- Truly yours, Stepan Dyatkovskiy
Nick Lewycky
2012-Jan-20 08:17 UTC
[LLVMdev] How to force the creation of arrays with zeroes?
Stepan Dyatkovskiy wrote:> Hi all. How to force the creation of arrays with zeroes? Or this use-case is not provided?That is impossible, LLVM will always canonicalize that to a ConstantAggregateZero. Nick
Duncan Sands
2012-Jan-20 08:22 UTC
[LLVMdev] How to force the creation of arrays with zeroes?
Hi Stepan,> Hi all. How to force the creation of arrays with zeroes? Or this use-case is not provided?you can't, you can only get a ConstantAggregateZero. This is actually kind of annoying, and means that places expecting a ConstantArray have to remember to also check for ConstantAggregateZero. Perhaps there's a good reason for the current design, but if not it would be great to eliminate this wart. Ciao, Duncan.
Anton Korobeynikov
2012-Jan-20 10:41 UTC
[LLVMdev] How to force the creation of arrays with zeroes?
> you can't, you can only get a ConstantAggregateZero. This is actually kind of > annoying, and means that places expecting a ConstantArray have to remember to > also check for ConstantAggregateZero. Perhaps there's a good reason for the > current design, but if not it would be great to eliminate this wart.Well, I think the main reason it so reduce the size of .ll / .bc when all operands are zero. If the array / struct is really big then this can save a lot of space. -- With best regards, Anton Korobeynikov Faculty of Mathematics and Mechanics, Saint Petersburg State University
Maybe Matching Threads
- [LLVMdev] How to force the creation of arrays with zeroes?
- [LLVMdev] How to force the creation of arrays with zeroes?
- [LLVMdev] How to force the creation of arrays with zeroes?
- [LLVMdev] [NVPTX] Backend cannot handle array-of-arrays constant
- [LLVMdev] identifing mallocs with constant sizes