<span style=" font-size:10pt;font-family:sans-serif">Hi all, I have this
problem:</span>
<br>
<br><span style=" font-size:10pt;font-family:sans-serif">I'm using LLVM's
C++ API, mostly `IRBuilder<>` to generate code. Some of the generated
code is just storing constant data to a location provided as a function
argument. Something like `ir_builder.CreateStore(get_default_data(), ptrValue)`
where `get_default_data()` may return a `ConstantArray` of `i8` and `ptrValue`
is a function argument. Looking at the generated assembly, it seems inefficient,
it generates a separate instruction for storing each byte relative to the
pointer. Each instruction takes several bytes, and I am trying to optimize
for code size.</span>
<br>
<br><span style=" font-size:10pt;font-family:sans-serif">The Q: What should
I do to make the generated code more size-efficient (think `-Os`)?</span>
<br>
<br><span style=" font-size:10pt;font-family:sans-serif">Current ideas,
which may not include the best answer:</span>
<br><span style=" font-size:10pt;font-family:sans-serif">- Store the data
as-is in the IR, and use the `MemCpyInst` instead of the store when `get_default_data()`
returns something big?</span>
<br><span style=" font-size:10pt;font-family:sans-serif">- Add a custom
-- or any available built-in -- pass to the output to transform the store
instns to memcpy when appropriate?</span>
<br>
<br><span style=" font-size:10pt;font-family:sans-serif">Thanks for any
help,</span>
<br><span style=" font-size:10pt;font-family:sans-serif">Boldizsar</span><PRE>This message and any attachments are intended for the use of the addressee or addressees only.
The unauthorised disclosure, use, dissemination or copying (either in whole or in part) of its
content is not permitted.
If you received this message in error, please notify the sender and delete it from your system.
Emails can be altered and their integrity cannot be guaranteed by the sender.

Please consider the environment before printing this email.

</PRE>