[PATCH] Fixing inst-combine not to drops nsw when combining adds into mul (PR19263)

Dinesh Dwivedi dinesh.d at samsung.com
Thu Jun 5 05:03:32 PDT 2014


> + if (ConstantInt *CI1 = dyn_cast<ConstantInt>(LHS))
> + if (ConstantInt *CI2 = dyn_cast<ConstantInt>(RHS)) {
> + APInt ACI1 = CI1->getValue();
> + APInt ACI2 = CI2->getValue();
> + bool IsLHSNegative = ACI1.isNegative();
> + bool IsRHSNegative = ACI2.isNegative();
> 
> If both are constants, the result should have been folded before
> getting here, no?

Here both constants are from different expression, one from LHS and other
one is from RHS.

> Can you rebase on trunk? WillNotOverflowSignedAdd has learned a few
> extra tricks.

rebased.

http://reviews.llvm.org/D3799






More information about the llvm-commits mailing list