> For PR1248: http://llvm.org/PR1248 : > * Fix some indentation and comments in InsertRangeTest > * Add an "IsSigned" parameter to AddWithOverflow and make it handle > signed > additions. Also, APIntify this function so it works with any > bitwidth. > * For the icmp pred ([us]div %X, C1), C2 transforms, exit early if the > div instruction's RHS is zero. > * Finally, for icmp pred (sdiv %X, C1), -C2, fix an off-by-one > error. The > HiBound needs to be incremented in order to get the range test > correct.
Thanks Reid, testcase please! > /// AddWithOverflow - Compute Result = In1+In2, returning true if > the result > /// overflowed for this type. > static bool AddWithOverflow(ConstantInt *&Result, ConstantInt *In1, > - ConstantInt *In2) { > + ConstantInt *In2, bool IsSigned = > false) { > Result = cast<ConstantInt>(ConstantExpr::getAdd(In1, In2)); > > - return cast<ConstantInt>(Result)->getZExtValue() < > - cast<ConstantInt>(In1)->getZExtValue(); > + if (IsSigned) > + if (In2->getValue().isNegative()) > + return Result->getValue().sgt(In1->getValue()); > + else > + return Result->getValue().slt(In1->getValue()); I don't understand this logic. Shouldn't it always be slt? -Chris _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits