summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/APInt.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-11-24 20:29:04 +0000
committerCraig Topper <craig.topper@intel.com>2017-11-24 20:29:04 +0000
commit03106bb40ed708a5d8f69d0c890575e15ffad53e (patch)
tree482bfd4816f234d65018d38ff67c1697d7c0c131 /llvm/lib/Support/APInt.cpp
parent13ed01e6355bced6736f39e2910ba98f0293c328 (diff)
downloadbcm5719-llvm-03106bb40ed708a5d8f69d0c890575e15ffad53e.tar.gz
bcm5719-llvm-03106bb40ed708a5d8f69d0c890575e15ffad53e.zip
Recommit r318963 "[APInt] Don't print debug messages from the APInt knuth division algorithm by default"
The previous commit had the condition in the do/while backwards. Debug builds currently print out low level details of the Knuth division algorithm when -debug is used. This information isn't useful in most cases and just adds noise to the log. This adds a new preprocessor flag to enable the prints in the knuth division code in APInt. Differential Revision: https://reviews.llvm.org/D40404 llvm-svn: 318966
Diffstat (limited to 'llvm/lib/Support/APInt.cpp')
-rw-r--r--llvm/lib/Support/APInt.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/lib/Support/APInt.cpp b/llvm/lib/Support/APInt.cpp
index c558ddd8216..1ea6319acfa 100644
--- a/llvm/lib/Support/APInt.cpp
+++ b/llvm/lib/Support/APInt.cpp
@@ -1252,6 +1252,14 @@ static void KnuthDiv(uint32_t *u, uint32_t *v, uint32_t *q, uint32_t* r,
// b denotes the base of the number system. In our case b is 2^32.
const uint64_t b = uint64_t(1) << 32;
+// The DEBUG macros here tend to be spam in the debug output if you're not
+// debugging this code. Disable them unless KNUTH_DEBUG is defined.
+#pragma push_macro("DEBUG")
+#ifndef KNUTH_DEBUG
+#undef DEBUG
+#define DEBUG(X) do {} while (false)
+#endif
+
DEBUG(dbgs() << "KnuthDiv: m=" << m << " n=" << n << '\n');
DEBUG(dbgs() << "KnuthDiv: original:");
DEBUG(for (int i = m+n; i >=0; i--) dbgs() << " " << u[i]);
@@ -1391,6 +1399,8 @@ static void KnuthDiv(uint32_t *u, uint32_t *v, uint32_t *q, uint32_t* r,
DEBUG(dbgs() << '\n');
}
DEBUG(dbgs() << '\n');
+
+#pragma pop_macro("DEBUG")
}
void APInt::divide(const WordType *LHS, unsigned lhsWords, const WordType *RHS,
OpenPOWER on IntegriCloud