Skip to content

Hack to workaround a clang lto bug #6782

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

Conversation

aschwaighofer
Copy link
Contributor

We hit an assert in AllocStackHoisting that is only triggered in a release lto
build.

Clang forwards the read of parent basic block of 'AssignedLoc' in the next
statement:

auto *EntryBB = AssignedLoc->getFunction()->getEntryBlock(); // read AssignedLoc->ParentBB
AssignedLoc->removeFromParent(); // writes AssignedLoc->ParentBB

To this read:

EntryBB->push_front(AssignedLoc); // read AssignedLoc->ParentBB and assert if non-null, should reload

As a temporary workaround outline code to prevent the miscompile.

rdar://29982182

We hit an assert in AllocStackHoisting that is only triggered in a release lto
build.

Clang forwards the read of parent basic block of 'AssignedLoc' in the next
statement:

  auto *EntryBB = AssignedLoc->getFunction()->getEntryBlock(); // read AssignedLoc->ParentBB
  AssignedLoc->removeFromParent(); // writes AssignedLoc->ParentBB

To this read:

  EntryBB->push_front(AssignedLoc); // read AssignedLoc->ParentBB and assert if non-null, *should reload*

As a temporary workaround outline code to prevent the miscompile.

rdar://29982182
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test

1 similar comment
@aschwaighofer
Copy link
Contributor Author

@swift-ci Please smoke test

@aschwaighofer aschwaighofer merged commit 2888cc7 into swiftlang:master Jan 13, 2017
@aschwaighofer
Copy link
Contributor Author

@swiftix Can you review for swift-3.1-branch?

@swiftix
Copy link
Contributor

swiftix commented Jan 13, 2017

@aschwaighofer LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants