Skip to content
This repository has been archived by the owner on Feb 5, 2019. It is now read-only.

StackColoring: smarter check for slot overlap #84

Merged
merged 1 commit into from
Jun 19, 2017

Conversation

arielb1
Copy link

@arielb1 arielb1 commented Jun 19, 2017

Summary:
The old check for slot overlap treated 2 slots S and T as
overlapping if there existed a CFG node in which both of the slots could
possibly be active. That is overly conservative and caused stack blowups
in Rust programs. Instead, check whether there is a single CFG node in
which both of the slots are possibly active together.

Fixes PR32488.

Patch by Ariel Ben-Yehuda [email protected]

Reviewers: thanm, nagisa, llvm-commits, efriedma, rnk

Reviewed By: thanm

Subscribers: dotdash

Differential Revision: https://reviews.llvm.org/D31583

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305193 91177308-0d34-0410-b5e6-96231b3b80d8

Summary:
The old check for slot overlap treated 2 slots `S` and `T` as
overlapping if there existed a CFG node in which both of the slots could
possibly be active. That is overly conservative and caused stack blowups
in Rust programs. Instead, check whether there is a single CFG node in
which both of the slots are possibly active *together*.

Fixes PR32488.

Patch by Ariel Ben-Yehuda <[email protected]>

Reviewers: thanm, nagisa, llvm-commits, efriedma, rnk

Reviewed By: thanm

Subscribers: dotdash

Differential Revision: https://reviews.llvm.org/D31583

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305193 91177308-0d34-0410-b5e6-96231b3b80d8
@alexcrichton alexcrichton merged commit 8e1e6e6 into rust-lang:rust-llvm-2017-04-13 Jun 19, 2017
arielb1 pushed a commit that referenced this pull request Jun 27, 2017
StackColoring: smarter check for slot overlap
bors added a commit to rust-lang/rust that referenced this pull request Jun 30, 2017
Rebase LLVM on top of LLVM 4.0.1

Fixes #42893.

Please don't backport this to beta as-is - I'm not sure I want rust-lang/llvm#84 to sneak to beta before it gets sufficient testing.

r? @alexcrichton
@infinity0
Copy link

Backporting 2b622a3 to Debian LLVM 4.0.1 causes this test failure:

FAIL: LLVM :: CodeGen/X86/StackColoring.ll (9465 of 19322)
******************** TEST 'LLVM :: CodeGen/X86/StackColoring.ll' FAILED ********************
Script:
--
/<<PKGBUILDDIR>>/build-llvm/./bin/llc -mcpu=corei7 -no-stack-coloring=false < /<<PKGBUILDDIR>>/test/CodeGen/X86/StackColoring.ll | /<<PKGBUILDDIR>>/build-llvm/./bin/FileCheck /<<PKGBUILDDIR>>/test/CodeGen/X86/StackColoring.ll --check-prefix=YESCOLOR --check-prefix=CHECK
/<<PKGBUILDDIR>>/build-llvm/./bin/llc -mcpu=corei7 -no-stack-coloring=false -stackcoloring-lifetime-start-on-first-use=false < /<<PKGBUILDDIR>>/test/CodeGen/X86/StackColoring.ll | /<<PKGBUILDDIR>>/build-llvm/./bin/FileCheck /<<PKGBUILDDIR>>/test/CodeGen/X86/StackColoring.ll --check-prefix=NOFIRSTUSE --check-prefix=CHECK
/<<PKGBUILDDIR>>/build-llvm/./bin/llc -mcpu=corei7 -no-stack-coloring=true  < /<<PKGBUILDDIR>>/test/CodeGen/X86/StackColoring.ll | /<<PKGBUILDDIR>>/build-llvm/./bin/FileCheck /<<PKGBUILDDIR>>/test/CodeGen/X86/StackColoring.ll --check-prefix=NOCOLOR --check-prefix=CHECK
--
Exit Code: 2

Command Output (stderr):
--
/<<PKGBUILDDIR>>/build-llvm/./bin/llc: <stdin>:598:13: error: use of undefined value '@llvm.lifetime.end.p0i8'
  call void @llvm.lifetime.end.p0i8(i64 256, i8* %bar_i8)
            ^
FileCheck error: '-' is empty.
FileCheck command line:  /<<PKGBUILDDIR>>/build-llvm/./bin/FileCheck /<<PKGBUILDDIR>>/test/CodeGen/X86/StackColoring.ll --check-prefix=YESCOLOR --check-prefix=CHECK

--

********************

Could you have a guess as to what the correct fix is?

@infinity0
Copy link

Possibly removing ".p0i8" from the test will fix it, testing it right now, will report back. The functions are defined with ".p0i8" in the upstream version of the commit (8e83a79) but not in the rust backport (2b622a3) so the latter should also have removed ".p0i8".

@dotdash
Copy link

dotdash commented Oct 18, 2017

Just remove the .p0i8 suffix on the intrinsics names. They were renamed in a later version, but the backport into our LLVM fork didn't adjust the names, which wasn't noticed because we don't run the LLVM testsuite.

@infinity0
Copy link

Confirmed that is enough to fix the tests, all passing now.

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

Successfully merging this pull request may close these issues.

5 participants