Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Issue 18197 - Correct optimization for OPpair in x87 mode #8082

Merged
merged 3 commits into from Mar 28, 2018

Conversation

LemonBoy
Copy link
Contributor

Attempting to push a non-fp value into mST0 results in a ICE.

The patch assumes OPpair is homogeneous, I hope that invariant holds (and should probably slip an assertion just to be sure).

@ibuclaw
Copy link
Member

ibuclaw commented Mar 26, 2018

I wonder why dlang bot hasn't picked this up. @LemonBoy spell Issue with a capital I in the commit?

Copy link
Member

@ibuclaw ibuclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wilzbach wilzbach changed the title Fix issue 18197 - Correct optimization for OPpair in x87 mode Fix Issue 18197 - Correct optimization for OPpair in x87 mode Mar 26, 2018
@dlang-bot
Copy link
Contributor

dlang-bot commented Mar 26, 2018

Thanks for your pull request and interest in making D better, @LemonBoy! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Auto-close Bugzilla Severity Description
18197 regression [REG2.073] Internal error: backend\cgcod.c 1659

⚠️⚠️⚠️ Warnings ⚠️⚠️⚠️

To target stable perform these two steps:

  1. Rebase your branch to upstream/stable:
git rebase --onto upstream/stable upstream/master
  1. Change the base branch of your PR to stable

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#8082"

@wilzbach
Copy link
Member

I wonder why dlang bot hasn't picked this up. @LemonBoy spell Issue with a capital I in the commit?

This first time when dlang-bot was called it got a 404 from the GH API:

GET https://api.github.com/repos/dlang/dmd/pulls/8082/commits failed; Not Found 404.

Not sure why though. It sometimes does run into the rate-limit, but then it gets a 403.
(Triggering an action, e.g. by changing the title is a workaround in these cases.)

@wilzbach wilzbach closed this Mar 27, 2018
@wilzbach wilzbach reopened this Mar 27, 2018
!el_appears(e2, e1->EV.sp.Vsym) &&
// Disable this rewrite if we're using x87 and the OPpair isn't made
// of FP values
(config.fpxmmregs || tyfloating(e2->E1->Ety) == tyfloating(e2->Ety))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tyfloating doesn't return a bool:

inline unsigned tyfloating(tym_t ty) { return tytab[ty & 0xFF] & (TYFLreal | TYFLimaginary | TYFLcomplex); }

so the test should be tyfloating() != 0

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

!el_appears(e2, e1->EV.sp.Vsym)
!el_appears(e2, e1->EV.sp.Vsym) &&
// Disable this rewrite if we're using x87 and the OPpair isn't made
// of FP values
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you mean OPpair isn't made of mixed FP and non-FP values?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reworded the comment a bit, I hope it's clearer now.

Attempting to push a non-fp value into mST0 results in a ICE.
!el_appears(e2, e1->EV.sp.Vsym)
!el_appears(e2, e1->EV.sp.Vsym) &&
// Disable this rewrite if we're using x87 and `e1` is a FP-value
// but `e2` is not
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or vice versa

// Disable this rewrite if we're using x87 and `e1` is a FP-value
// but `e2` is not
(config.fpxmmregs ||
tyfloating(e2->E1->Ety) != 0 == tyfloating(e2->Ety) != 0)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need parens here:

(tyfloating(e2->E1->Ety) != 0) == (tyfloating(e2->Ety) != 0)

@dlang-bot dlang-bot merged commit 69ece8c into dlang:master Mar 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants