[llvm] r302931 - [APInt] Add an assert to check for divide by zero in udivrem. NFC
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Fri May 12 11:19:01 PDT 2017
Author: ctopper
Date: Fri May 12 13:19:01 2017
New Revision: 302931
URL: http://llvm.org/viewvc/llvm-project?rev=302931&view=rev
Log:
[APInt] Add an assert to check for divide by zero in udivrem. NFC
udiv and urem already had the same assert.
Modified:
llvm/trunk/lib/Support/APInt.cpp
Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=302931&r1=302930&r2=302931&view=diff
==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Fri May 12 13:19:01 2017
@@ -1662,6 +1662,7 @@ void APInt::udivrem(const APInt &LHS, co
// Get some size facts about the dividend and divisor
unsigned lhsWords = getNumWords(LHS.getActiveBits());
unsigned rhsWords = getNumWords(RHS.getActiveBits());
+ assert(rhsWords && "Performing divrem operation by zero ???");
// Check the degenerate cases
if (lhsWords == 0) {
More information about the llvm-commits
mailing list