[LLVMdev] Prevent sizeof being replaced by a constant in IR
Krzysztof Parzyszek
kparzysz at codeaurora.org
Mon Apr 14 06:56:40 PDT 2014
On 4/14/2014 8:35 AM, Peter Conn wrote:
> Hello,
>
> Using the following command:
>
> clang -O0 -S -emit-llvm size.c
>
> Will generate an LLVM IR file where uses of 'sizeof' have been replaced
> by constants. Is there any way to prevent this, and perhaps leave the
> 'sizeof's replaced by GEPs as detailed here:
> http://nondot.org/sabre/LLVMNotes/SizeOf-OffsetOf-VariableSizedStructs.txt
"sizeof" _is_ a constant.
The technique from the note only works for aggregates that end with an
array (or arrays themselves).
-Krzysztof
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
More information about the llvm-dev
mailing list