Stephen Canon
2014-Sep-25 23:05 UTC
[LLVMdev] Optimization of sqrt() with invalid argument
> On Sep 25, 2014, at 6:41 PM, Tim Northover <t.p.northover at gmail.com> wrote: > >> This is important in practice because of the xalanc benchmark in SPEC >> CPU2006. > > No, it would be important in practice for really used legacy (i.e. > unfixable) code relying on this undefined behaviour. It's important > for gaming the system if it occurs in SPEC.We should fix it because it costs us nothing to do and conforms to IEEE-754, and there’s no good reason to maintain the current behavior. – Steve
Bill raised another question in the bug report that I'm curious about too: Is anyone or any bot running/posting SPEC CPU results for clang? I know it's part of test-suite/external, but this constant fold code has been around 5+ years. Was the bug lying dormant all this time, only visible on PPC, or something else? -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20140926/5c2bbf9d/attachment.html>
Tim Northover
2014-Sep-26 15:38 UTC
[LLVMdev] Optimization of sqrt() with invalid argument
> We should fix it because it costs us nothing to do and conforms to IEEE-754, and there’s no good reason to maintain the current behavior.Probably, but there are theoretical issues: 0 is easier for other optimisations to deal with than NaN (especially after constant propagation). It's also creating NaNs in situations where they've been explicitly disabled (the @llvm.sqrt intrinsic only really gets created in finite math mode). In my perfect world we'd optimise it to a segfault. I doubt anything bad will actually happen though, so I'm not actually bothered one way or the other; just vaguely annoyed that compilers get changed to accommodate broken benchmarks (well, more accurately, to allow us to sneak a -ffast-math compile into our numbers when the benchmark wasn't designed for it). Cheers. Tim.
Tim Northover
2014-Sep-26 15:59 UTC
[LLVMdev] Optimization of sqrt() with invalid argument
> I know it's part of test-suite/external, but this constant fold code has > been around 5+ years. Was the bug lying dormant all this time, only visible > on PPC, or something else?My guess would be that people don't tend to run with -ffast-math (it's got a reputation for breaking code, even ignoring this particular issue). Without that, from what I can see the issue won't arise. But that doesn't account for complete silence, it must happen occasionally. Cheers. Tim.
Possibly Parallel Threads
- [LLVMdev] Optimization of sqrt() with invalid argument
- [LLVMdev] Optimization of sqrt() with invalid argument
- [LLVMdev] Optimization of sqrt() with invalid argument
- [LLVMdev] Optimization of sqrt() with invalid argument
- [LLVMdev] Optimization of sqrt() with invalid argument