Bug 174034 - B3ReduceDoubleToFloat incorrectly reduces operations over two double constants
Summary: B3ReduceDoubleToFloat incorrectly reduces operations over two double constants
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Saam Barati
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-06-30 13:10 PDT by Saam Barati
Modified: 2017-07-01 13:49 PDT (History)
13 users (show)

See Also:


Attachments
patch (5.95 KB, patch)
2017-06-30 14:17 PDT, Saam Barati
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Saam Barati 2017-06-30 13:10:16 PDT
e.g, we'll change this program:

a = DoubleConst(c1)
b = DoubleConst(c2)
c = EqualOrUnordered(@a, @b)

into:

a = FloatConst(static_cast<float>(c1))
b = FloatConst(static_cast<float>(c2))
c = EqualOrUnordered(@a, @b)

Which is clearly wrong. The example program where this goes wrong is for a denormal negative zero. We have this comparison:
a = DoubleConst(0x8000000000000001)
b = DoubleConst(0x0000000000000000)
c = EqualOrUnordered(@a, @b)

into:
a = FloatConst(0x80000000)
b = FloatConst(0x00000000)
c = EqualOrUnordered(@a, @b)

And this will produce different program behavior.
Comment 1 Saam Barati 2017-06-30 14:09:33 PDT
<rdar://problem/30793007>
Comment 2 Saam Barati 2017-06-30 14:17:54 PDT
Created attachment 314289 [details]
patch
Comment 3 WebKit Commit Bot 2017-06-30 16:37:04 PDT
Comment on attachment 314289 [details]
patch

Clearing flags on attachment: 314289

Committed r219026: <http://trac.webkit.org/changeset/219026>
Comment 4 WebKit Commit Bot 2017-06-30 16:37:06 PDT
All reviewed patches have been landed.  Closing bug.
Comment 5 Csaba Osztrogonác 2017-06-30 22:52:03 PDT
(In reply to WebKit Commit Bot from comment #3)
> Comment on attachment 314289 [details]
> patch
> 
> Clearing flags on attachment: 314289
> 
> Committed r219026: <http://trac.webkit.org/changeset/219026>

It broke the GCC build, see build.webkit.org for details, for example the GTK bots and AArch64 bot.
Comment 7 Yusuke Suzuki 2017-07-01 02:36:41 PDT
Committed r219047: <http://trac.webkit.org/changeset/219047>
Comment 8 Saam Barati 2017-07-01 13:49:04 PDT
(In reply to Yusuke Suzuki from comment #7)
> Committed r219047: <http://trac.webkit.org/changeset/219047>

Thanks!