[LLVMdev] Proposal: intp type

Kenneth Uildriks kennethuil at gmail.com
Fri Nov 13 11:37:18 PST 2009


On Fri, Nov 13, 2009 at 1:31 PM, John McCall <rjmccall at apple.com> wrote:
> John McCall wrote:
>> I didn't realize that an identity zext was actually invalid IR.  That
>> seems like it probably causes more trouble than it's worth.
>>
>> Anyway, I suspect the question is whether you would rather break these
>> invariants (which are probably not critical for most optimizations) or
>> slowly accumulate duplicate code paths in every pass that looks at zexts
>> and truncs.
>>
>
> Actually, I take this back;  there are definitely common optimizations
> that are going to be much more complicated if they have to deal with
> intptrs, most obviously instcombining trunc/zext/sext.

If you're leaving out target data, you're clearly going to miss
target-specific optimization opportunities.  That's the breaks when
you're doing target-independent optimizations.  But you can always
optimize again with target data once you've selected a target.

If there is target data, then intptr reduces to a plain int of the
appropriate size, and conversion instructions involving intptr can
resolve to the integer trunc/zext/sext equivalent, and instcombining
can proceed as normal with all sizes known.




More information about the llvm-dev mailing list