Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Issue 2177033002: Subzero: Local variable splitting. (Closed)

Created:
4 years, 5 months ago by Jim Stichnoth
Modified:
4 years, 4 months ago
Reviewers:
manasijm, Karl, John, Eric Holk
CC:
native-client-reviews_googlegroups.com
Base URL:
https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Target Ref:
refs/heads/master
Visibility:
Public.

Description

Subzero: Local variable splitting. The linear-scan register allocator takes an all-or-nothing approach -- either the variable's entire live range gets a register, or none of it does. To help with this, we add a pass that splits successive uses of a variable within a basic block into a chain of linked variables. This gives the register allocator the chance to allocate registers to subsets of the original live range. The split variables are linked to each other so that if they don't get a register, they share a stack slot with the original variable, and redundant writes to that stack slot are recognized and elided. This pass is executed after target lowering and right before register allocation. As such, it has to deal with some idiosyncrasies of target lowering, specifically the possibility of intra-block control flow. We experimented with doing this as a pre-lowering pass. However, the transformations interfered with some of the target lowering's pattern matching, such as bool folding, so we concluded that post-lowering was a better place for it. Note: Some of the lit tests are overly specific about registers, and in these cases it was the path of least resistance to just disable local variable splitting. BUG= none R=eholk@chromium.org, jpp@chromium.org Committed: https://gerrit.chromium.org/gerrit/gitweb?p=native_client/pnacl-subzero.git;a=commit;h=b9a847280e4486e566dabdd5b0d571309b4ad628

Patch Set 1 #

Patch Set 2 : Cleanup #

Total comments: 13

Patch Set 3 : Code review changes. Fix a bad transformation. #

Total comments: 2

Patch Set 4 : Fix bug with LinkedTo chains. Fix performance problem. #

Total comments: 4

Patch Set 5 : Move variable splitting pass into a separate file. #

Patch Set 6 : Break up the big function into smaller helpers. #

Total comments: 22

Patch Set 7 : Prune unnecessary splits. Handle phi instructions. #

Total comments: 4

Patch Set 8 : Code review changes, mostly renaming. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+754 lines, -74 lines) Patch
M Makefile.standalone View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download
M src/IceCfg.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/IceCfgNode.h View 1 2 3 4 5 6 1 chunk +2 lines, -0 lines 0 comments Download
M src/IceClFlags.h View 2 chunks +4 lines, -0 lines 0 comments Download
M src/IceClFlags.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M src/IceClFlags.def View 2 chunks +6 lines, -0 lines 0 comments Download
M src/IceInst.h View 1 2 2 chunks +9 lines, -2 lines 0 comments Download
M src/IceInst.cpp View 1 2 3 3 chunks +13 lines, -1 line 0 comments Download
M src/IceInstX86Base.h View 1 2 2 chunks +2 lines, -0 lines 0 comments Download
M src/IceOperand.h View 1 2 4 chunks +33 lines, -2 lines 0 comments Download
M src/IceOperand.cpp View 1 2 3 chunks +10 lines, -7 lines 0 comments Download
M src/IceTargetLowering.h View 1 1 chunk +10 lines, -0 lines 0 comments Download
M src/IceTargetLowering.cpp View 1 2 4 chunks +8 lines, -35 lines 0 comments Download
M src/IceTargetLoweringX86Base.h View 1 chunk +2 lines, -0 lines 0 comments Download
M src/IceTargetLoweringX86BaseImpl.h View 1 2 3 4 6 chunks +20 lines, -8 lines 0 comments Download
M src/IceTimerTree.def View 1 chunk +1 line, -0 lines 0 comments Download
A + src/IceVariableSplitting.h View 1 2 3 4 2 chunks +7 lines, -8 lines 0 comments Download
A src/IceVariableSplitting.cpp View 1 2 3 4 5 6 7 1 chunk +608 lines, -0 lines 0 comments Download
M tests_lit/assembler/x86/opcode_register_encodings.ll View 1 chunk +1 line, -1 line 0 comments Download
M tests_lit/llvm2ice_tests/callindirect.pnacl.ll View 1 1 chunk +4 lines, -0 lines 0 comments Download
M tests_lit/llvm2ice_tests/fused-alloca.ll View 1 chunk +3 lines, -3 lines 0 comments Download
M tests_lit/llvm2ice_tests/multidef_kill.ll View 1 chunk +1 line, -0 lines 0 comments Download
M tests_lit/llvm2ice_tests/nacl-atomic-intrinsics.ll View 4 chunks +4 lines, -4 lines 0 comments Download
M tests_lit/llvm2ice_tests/randomize-regalloc.ll View 2 chunks +2 lines, -2 lines 0 comments Download
M tests_lit/llvm2ice_tests/rng.ll View 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 16 (5 generated)
Jim Stichnoth
This seems to improve spec2k by 1-2% overall, with ~5% gains on 2-3 of them.
4 years, 5 months ago (2016-07-24 05:42:24 UTC) #5
Eric Holk
lgtm My comments were mostly just questions and naming suggestions, so feel free to consider ...
4 years, 4 months ago (2016-07-25 19:59:22 UTC) #6
Jim Stichnoth
Along with the code review changes, I also found and fixed an error in one ...
4 years, 4 months ago (2016-07-26 05:59:09 UTC) #7
John
no ARM? :( https://codereview.chromium.org/2177033002/diff/40001/src/IceCfg.cpp File src/IceCfg.cpp (right): https://codereview.chromium.org/2177033002/diff/40001/src/IceCfg.cpp#newcode909 src/IceCfg.cpp:909: void Cfg::splitLocalVars() { this is really ...
4 years, 4 months ago (2016-07-26 18:59:39 UTC) #8
Jim Stichnoth
PTAL. If you care to follow along, I uploaded 3 patchsets since the last review. ...
4 years, 4 months ago (2016-07-28 23:37:03 UTC) #9
Eric Holk
still lgtm
4 years, 4 months ago (2016-07-29 18:40:58 UTC) #10
Jim Stichnoth
Sorry, one "last" patchset, with the following changes: 1. Don't bother splitting the last use ...
4 years, 4 months ago (2016-07-30 20:06:56 UTC) #11
John
lgtm https://codereview.chromium.org/2177033002/diff/60001/src/IceCfg.cpp File src/IceCfg.cpp (right): https://codereview.chromium.org/2177033002/diff/60001/src/IceCfg.cpp#newcode959 src/IceCfg.cpp:959: // A->getIndex()>B->getIndex(). add spaces around ' > ' ...
4 years, 4 months ago (2016-08-01 14:17:33 UTC) #12
Jim Stichnoth
Still one comment to be addressed. https://codereview.chromium.org/2177033002/diff/60001/src/IceCfg.cpp File src/IceCfg.cpp (right): https://codereview.chromium.org/2177033002/diff/60001/src/IceCfg.cpp#newcode959 src/IceCfg.cpp:959: // A->getIndex()>B->getIndex(). On ...
4 years, 4 months ago (2016-08-01 15:13:51 UTC) #13
Jim Stichnoth
https://codereview.chromium.org/2177033002/diff/100001/src/IceVariableSplitting.cpp File src/IceVariableSplitting.cpp (right): https://codereview.chromium.org/2177033002/diff/100001/src/IceVariableSplitting.cpp#newcode207 src/IceVariableSplitting.cpp:207: if (Instr == WaitingForLabel) { On 2016/08/01 14:17:32, John ...
4 years, 4 months ago (2016-08-01 19:55:36 UTC) #14
Jim Stichnoth
4 years, 4 months ago (2016-08-01 20:18:41 UTC) #16
Message was sent while issue was closed.
Committed patchset #8 (id:140001) manually as
b9a847280e4486e566dabdd5b0d571309b4ad628 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698