[PATCH] D31716: [Builtins] Fix div0 error in udivsi3

Weiming Zhao via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 5 11:23:27 PDT 2017


weimingz updated this revision to Diff 94265.
weimingz added a comment.

I think the r7 (fp) was not set to initial SP, so it won't matter for stack-based unwinding. Anyway, use r7 now.


https://reviews.llvm.org/D31716

Files:
  lib/builtins/arm/udivsi3.S


Index: lib/builtins/arm/udivsi3.S
===================================================================
--- lib/builtins/arm/udivsi3.S
+++ lib/builtins/arm/udivsi3.S
@@ -186,9 +186,12 @@
 LOCAL_LABEL(divby0):
 	movs	r0, #0
 #      if defined(__ARM_EABI__)
+	push {r7, lr}
 	bl	__aeabi_idiv0 // due to relocation limit, can't use b.
-#      endif
+	pop  {r7, pc}
+#      else
 	JMP(lr)
+#      endif
 
 
 #if __ARM_ARCH_ISA_THUMB == 1


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31716.94265.patch
Type: text/x-patch
Size: 432 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170405/103dcbfa/attachment.bin>


More information about the llvm-commits mailing list