[PATCH] D24076: [ARM] Use __rt_div functions for DIVREM on Windows

Martin Storsjö via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 03:50:35 PDT 2016


mstorsjo added a comment.

In https://reviews.llvm.org/D24076#560523, @rengolin wrote:

> Right, the change now looks good, but I'll let @compnerd approve, since I'm not that well versed in the Windows ABI.


FWIW, one of the remaining issues is that I don't (currently) add the DBZCHK (division by zero check) before the __rt_div calls for divrem or rem. I can add that as well (I got a patch for it locally). But IMO the question remains whether we should add that at all. MSVC does add it (both for div and rem, which are calls to the same function), but the actual implementations of the functions also do similar checks internally, so it feels redundant. But I guess the ABI of those functions mandate that the caller checks it.

The current implementation of DBZCHK also has got an issue, that it issues a CBZ, but later passes may move the branch target might out of range, see https://llvm.org/bugs/show_bug.cgi?id=30356 and the function EmitLowered__dbzchk.

If we can remove DBZCHK altogether, it'd be easy, but I'm not sure how to fix the current one.


https://reviews.llvm.org/D24076





More information about the llvm-commits mailing list