summaryrefslogtreecommitdiffstats
path: root/lld/ELF/ScriptParser.cpp
diff options
context:
space:
mode:
authorJF Bastien <jfbastien@apple.com>2019-09-06 16:26:59 +0000
committerJF Bastien <jfbastien@apple.com>2019-09-06 16:26:59 +0000
commit52614dfc7fd09d3de608068415eaa632c21c661d (patch)
treee0595fcb7354060c8413a6723ecf2321c888b97d /lld/ELF/ScriptParser.cpp
parentd1cc181d03b3c0d1f0e500f5826562a6e4667018 (diff)
downloadbcm5719-llvm-52614dfc7fd09d3de608068415eaa632c21c661d.tar.gz
bcm5719-llvm-52614dfc7fd09d3de608068415eaa632c21c661d.zip
[InstCombine] pow(x, +/- 0.0) -> 1.0
Summary: This isn't an important optimization at all... We're already doing: pow(x, 0.0) -> 1.0 My patch merely teaches instcombine that -0.0 does the same. However, doing this fixes an AMAZING bug! Compile this program: extern "C" double pow(double, double); double boom(double base) { return pow(base, -0.0); } With: clang++ ~/Desktop/fast-math.cpp -ffast-math -O2 -S And clang will crash with a signal. Wow, fast math is so fast it ICEs the compiler! Arguably, the generated math is infinitely fast. What's actually happening is that we recurse infinitely in getPow. In debug we hit its assertion: assert(Exp != 0 && "Incorrect exponent 0 not handled"); We avoid this entire mess if we instead recognize that an exponent of positive and negative zero yield 1.0. A separate commit, r371221, fixed the same problem. This only contains the added tests. <rdar://problem/54598300> Reviewers: scanon Subscribers: hiraditya, jkorous, dexonsmith, ributzka, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D67248 llvm-svn: 371224
Diffstat (limited to 'lld/ELF/ScriptParser.cpp')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud