The APInt::KnuthDiv uses push_macro/pop_macro to temporarily redefine the LLVM_DEBUG macro.
It turns out that when building with LLVM_ENABLE_MODULES, clang doesn't correctly
handle the push_macro/pop_macro pragmas, which causes that LLVM_DEBUG is actually undefined
after KnuthDiv calls pop_macro. This hasn't been a problem so far as we never used LLVM_DEBUG
after the KnuthDiv implementation.
However, rL338758 added new uses of the LLVM_DEBUG macro after the KnuthDiv implementation,
which now fail to compile with LLVM_ENABLE_MODULES as clang can't find the definition of
LLVM_DEBUG.
To fix the LLVM builds with enabled modules, we either move the KnuthDiv implementation to the end
of the file, or we just replace the use of push_macro/pop_macro pragmas. This patch uses the latter
option because it's less intrusive to the change log.