[llvm-dev] [RFC] bitfield access shrinking

Krzysztof Parzyszek via llvm-dev llvm-dev at lists.llvm.org
Fri Mar 10 07:22:54 PST 2017


On 3/10/2017 2:20 AM, Chandler Carruth wrote:
>
> We have had *numerous* test cases from benchmarks where combining basic
> bitfield math is important. So while in some cases it may not be
> important, in a number of cases it is and so I feel like we should
> design things to support reasonably comprehensive combining of the
> bitfield accesses.

Interesting. What usually happens in our cases is that the bitwise 
extraction logic gets combined into code that is hard to generate 
optimal code for. It's usually the shifts and ands from the extraction 
code itself that get rewritten between themselves, but I haven't seen 
many cases where the surrounding arithmetic would be a part of it (I 
meant addition, subtraction, etc, not further bitwise ops). When the 
surrounding code has more bitwise operations on the extracted bitfield, 
the extraction may be completely eliminated (which is something that the 
combiner could do).

I agree that if we tried to aggressively canonicalize towards such 
intrinsics, it would likely create more problems than it would solve.

That said, it was just a loose idea, not something I intend to insist on...


>     > The main generator of the bitwise manipulation is SROA
>
>
> ?? Clang directly generates the bit insert and extract patterns as well?

Sorry, I didn't mean to pick on SROA. ;)


-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