[LLVMdev] Integer divide by zero

Cameron McInally cameron.mcinally at nyu.edu
Sat Apr 6 01:07:13 PDT 2013


Hey Owen,

Thanks for your reply. I definitely understand your perspective. Hopefully
I can change it.  }:-)

On Sat, Apr 6, 2013 at 1:18 AM, Owen Anderson <resistor at mac.com> wrote:
...

> As I've pointed out, clang does provide such functionality as an opt-in
> feature through its -fsanitize options.  A hypothetical Fortran frontend
> could do the same, and even make it an opt-out feature if it chose.  I'm
> sorry if its implementation mechanism doesn't match exactly what you want
> it to be, but it's not like nobody else has thought about this problem.
>  They have, and they've designed and shipped a solution!
>
> Side note: even if the -fsanitize option introduces a branch around the
> division (which I haven't verified), it's quite unlikely to cause a
> significant performance regression.  The branch to the error block should
> be perfectly predicted on any CPU made in the last 25 years.
>
>
Even on a Xeon Phi? Just kidding around!

All kidding aside, an instruction is an instruction. We have the
functionality in hardware for free; it would be a shame not to use it. I
should also mention that for our team, performance is job #1. Extra
instructions, however insignificant, don't go over well without solid
justification.

Please don't misunderstand, I'm not trying to be unreasonable about this
behaviour change. I do believe that there are a few strong arguments for
this behaviour that we haven't touched upon yet. I also believe that this
option would be an improvement to LLVM overall. But, I also haven't heard
anyone in the community voicing interest. So, if no one speaks up and would
like to discuss further, I'll be happy to keep such a change in my local
branch.

-Cameron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20130406/c66185f3/attachment.html>


More information about the llvm-dev mailing list