[llvm-commits] [llvm] r85478 - /llvm/trunk/lib/Analysis/MemoryBuiltins.cpp

Duncan Sands baldrick at free.fr
Thu Oct 29 01:26:35 PDT 2009


Hi,

>        ConstantInt* Op1Int = dyn_cast<ConstantInt>(Op1);
>        if (!Op1Int) return NULL;
>        Value* Op1Pow = ConstantInt::get(Op1->getType(),
> -                                       pow(2, Op1Int->getZExtValue()));
> +                                       pow((double) 2, (double) Op1Int->getZExtValue()));

this is an integer power: 2 to the power of Op1Int.  This shouldn't be done like
this at all!  It's just a shift left for heavens sake - why the doubles?!  It
can other be done in uint64_t, or using the APInt shift methods.

/me makes note to self to audit this code for other monstrosities.

Ciao,

Duncan.



More information about the llvm-commits mailing list