APInt uses Knuth's D algorithm for long division. In rare cases the implementation applied a transformation that was not needed.
Minor nitpicks, LGTM.
Could b be LLVM_CONSTEXPR ?
The parenthesis around the shift make the expression more readable, even if not required.
You flipped the | arguments so they would consistent with the usual u[j+n], u[j+n-1]...u[j] representation?
I'd remove the FIXME and explain that *currently* this is a dead case since all callers in APInt calls either test for divide() with lhswords == rhswords == 1 or proivde the a small radix before calling divide() but it is worth keeping this code alive for correctness in case some new code does call divide() with lhswords == rhswords == 1.
Probably. I'm not used to constexpr because Visual Studio still does not support it.
I flipped arguments because I like high word being on the left. You shift left to make space for a low word.
Ok, I will change that. I'm just a bit worried that this code cannot be reached with unittests.