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

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Wed Jun 4 12:37:06 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?

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

http://reviews.llvm.org/D3799






More information about the llvm-commits mailing list