This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Take known zero bits into account when checking extraction.


On Mon, 9 May 2016, Dominik Vogt wrote:

This turns out to be quite difficult.  A small test function
effectively just returns the argument:

 unsigned long bar (unsigned long in)
 {
   if ((in & 1) == 0)
     in = (in & ~(unsigned long)1);

   return in;
 }

However, Gcc does not notice that the AND is a no-op.  As far as I
understand, zero bit tracking is only done in "combine", so when
folding the assignment statement the information that the lowest
bit is zero is not available and therefore the no-op is not
detected?

VRP is also supposed to track bits that may/must be non-zero. It may be possible to enhance it to handle this case.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]