[lld] r233088 - [Mips] Suppress "right shift by too large amount" warning

Simon Atanasyan simon at atanasyan.com
Wed Mar 25 10:38:14 PDT 2015


On Wed, Mar 25, 2015 at 8:30 PM, David Blaikie <dblaikie at gmail.com> wrote:
>
> On Wed, Mar 25, 2015 at 6:20 AM, Simon Atanasyan <simon at atanasyan.com>
> wrote:
>>
>> I hope the problem has been fixed by r233186. Unfortunately using
>> getRInfo does not solve the problem because in 32-bit case we extract
>> too much data and touch symbol index part of r_info field.
>>
>> So I just factor out the code that gets the "tag" into the separate
>> function. That allows to keep all bit manipulation code into the
>> single place and removes the warning.
>
>
> This (to me - though lld isn't my project, etc) just seems to complicate the
> code further - what's the point of &ing the 0xFFFFFF00 mask if you're just
> shifting down 8 anyway? This hides the issue from the compiler because the
> bitwise & does integer promotion (so the char is promoted to int, then
> and-ed, then shifted, so the shift is over an int instead of a char) but
> produces exactly the same result & now makes the optimizer (& reader) do a
> bit more work?

The general goal is to extract high 24 bits of r_info field. I think
using the 0xffffff00 mask is a good method to state this goal.
Shifting right by 8 bits is just an attempt to simplify the following
usage of the _tag field.

By the way, what do you suggest to silence the VC++ warning?

-- 
Simon Atanasyan



More information about the llvm-commits mailing list