[llvm-dev] [RFC] bitfield access shrinking

Hal Finkel via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 9 11:22:45 PST 2017


On 03/09/2017 12:57 PM, Krzysztof Parzyszek wrote:
> On 3/9/2017 12:47 PM, Hal Finkel wrote:
>>
>> On 03/09/2017 12:28 PM, Krzysztof Parzyszek via llvm-dev wrote:
>>> We could add intrinsics to extract/insert a bitfield, which would
>>> simplify a lot of that bitwise logic.
>>
>> But then you need to teach a bunch of places about how to simply them,
>> fold using bitwise logic and other things that reduce demanded bits into
>> them, etc. This seems like a difficult tradeoff.
>
> Bitfield extraction/insertion generally does not simplify well with 
> surrounding arithmetic.

Maybe. I've seen plenty of places where we've simplified bitfield 
extractions/insertions with other using/generating logic (masks, shifts, 
and the like).

> The main generator of the bitwise manipulation is SROA and if it was 
> the only creator of these intrinsics, it would already make things 
> simpler. We'd also need to teach the combiner about them, but that's 
> still fairly localized.
> On the other hand, they would make the intent of the code explicit. 
> Targets could handle them any way they want, whether it's loading an 
> i128, or an i16 from an adjusted offset.

I wouldn't want just SROA to produce them. If we're going to have them, 
then we should canonicalize toward them. That implies having matching 
logic, so perhaps we're back where we started.

  -Hal

>
> -Krzysztof
>

-- 
Hal Finkel
Lead, Compiler Technology and Programming Languages
Leadership Computing Facility
Argonne National Laboratory



More information about the llvm-dev mailing list