[LLVMdev] Vector logic regression in r73431

Eli Friedman eli.friedman at gmail.com
Thu Jul 30 09:23:00 PDT 2009

On Thu, Jul 30, 2009 at 5:57 AM, Nicolas Capens<nicolas at capens.net> wrote:
> No, that appears to be something unrelated. I'm currently using revision
> 75246, while that patch only seems to apply to some later revision.

I don't see the connection... anyway, I can't easily help you with an
old revision.

> Anyway, I actually located the real bug. Right at the end of
> InstCombiner::SimplifyDemandedUseBits, there's this piece of code:
>  // If the client is only demanding bits that we know, return the known
>  // constant.
>  if ((DemandedMask & (RHSKnownZero|RHSKnownOne)) == DemandedMask) {
>    Constant *C = Context->getConstantInt(RHSKnownOne);
>    if (isa<PointerType>(V->getType()))
>      C = Context->getConstantExprIntToPtr(C, V->getType());
>    return C;
>  }
>  return false;
> }
> Note that C is a scalar integer, and so when V is actually a vector the type
> isn't preserved.

Right... my patch fixes that, I think.

> I'm not entirely sure how this function is supposed to work with vectors
> though. DemandedMask, KnownOne and KnownZero are APInt's (scalars) the size
> of an element of the vector. So when, as the comment describes, only known
> bits are demanded, does that apply to just one element of the vector or all?

It applies to all elements of the vector.


More information about the llvm-dev mailing list