[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Reid Spencer rspencer at reidspencer.com
Wed Mar 28 07:11:02 PDT 2007


On Wed, 2007-03-28 at 14:23 +0800, Zhou Sheng wrote:
> 在 2007-03-27二的 22:17 -0700,Reid Spencer写道:

> > > >        KnownOne |= NewBits;
> > > > -      KnownZero &= ~NewBits;
> > > > -    } else {                              // Input sign bit unknown
> > > > -      KnownZero &= ~NewBits;
> > > > -      KnownOne &= ~NewBits;
> > > > -    }
> > > 
> > > Why did you delete this? What if the sign bit is unknown? (neither known
> > > one nor known zero).  Please revert.
> > 
> > This however is still a problem. It is quite possible for KnownZero[X]
> > and KnownOne[X] to both be false.
> I looked into the context, the *else* case is possible, but, as the
> NewBits are : 
> 
> APInt NewBits(APInt::getHighBitsSet(BitWidth, BitWidth - SrcBitWidth));
> 
> So ~NewBits should be a Mask of SrcBitWidth, and as KnownZero, KnownOne
> are just zexted from SrcBitWidth to BitWidth, so, the &= operation will
> be useless.

I see. I didn't have the full context on the trunc/zext. However, now
what you can do is move the construction of NewBits into each of the two
cases. This will avoid constructing it in the event that the sign bit is
not sent in either KnownZero nor KnownOne.

Thanks Sheng,

Reid.





More information about the llvm-commits mailing list