[llvm-commits] [llvm] r61395 - in /llvm/trunk/lib/CodeGen/SelectionDAG: SelectionDAGBuild.cpp SelectionDAGBuild.h

Duncan Sands baldrick at free.fr
Mon Dec 29 05:36:33 PST 2008


Hi Anton, thanks for doing this.

> +    const APInt& LEnd = cast<ConstantInt>(I->High)->getValue();
> +    const APInt& RBegin = cast<ConstantInt>(J->Low)->getValue();
> +    assert((RBegin - LEnd - 1).isNonNegative() && "Invalid case distance");

Mightn't RBegin - LEnd assert if the bit widths are different?

> +    double LDensity = (double)LSize / (LEnd - First + 1ULL).roundToDouble();
> +    double RDensity = (double)RSize / (Last - RBegin + 1ULL).roundToDouble();
> +    double Metric = (RBegin-LEnd).logBase2()*(LDensity+RDensity);

Likewise.

> +      cast<ConstantInt>(C)->getValue() ==
> +      (cast<ConstantInt>(CR.GE)->getValue() + 1LL)) {

Could be a similar problem here.

> +      cast<ConstantInt>(RHSR.first->Low)->getValue() ==
> +      (cast<ConstantInt>(CR.LT)->getValue() - 1LL)) {

Likewise.

> +  APInt cmpRange = maxValue -  minValue;

Likewise.

> +    uint64_t lo = (lowValue - lowBound).getZExtValue();
> +    uint64_t hi = (highValue - lowBound).getZExtValue();

Likewise.  Also, it uses getZExtValue - is this safe?

Ciao,

Duncan.



More information about the llvm-commits mailing list