-
Notifications
You must be signed in to change notification settings - Fork 47.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update base for Update on "[compiler] Optimize instruction reordering"
Note: due to a bad rebase i included #29883 here. Both were stamped so i'm not gonna bother splitting it back up aain. This PR includes two changes: * First, allow `LoadLocal` to be reordered if a) the load occurs after the last write to a variable and b) the LoadLocal lvalue is used exactly once * Uses a more optimal reordering for statement blocks, while keeping the existing approach for expression blocks. In #29863 I tried to find a clean way to share code for emitting instructions between value blocks and regular blocks. The catch is that value blocks have special meaning for their final instruction — that's the value of the block — so reordering can't change the last instruction. However, in finding a clean way to share code for these two categories of code, i also inadvertently reduced the effectiveness of the optimization. This PR updates to use different strategies for these two kinds of blocks: value blocks use the code from #29863 where we first emit all non-reorderable instructions in their original order, then try to emit reorderable values. The reason this is suboptimal, though, is that we want to move instructions closer to their dependencies so that they can invalidate (merge) together. Emitting the reorderable values last prevents this. So for normal blocks, we now emit terminal operands first. This will invariably cause some of the non-reorderable instructions to be emitted, but it will intersperse reoderable instructions in between, right after their dependencies. This maximizes our ability to merge scopes. I think the complexity cost of two strategies is worth the benefit, as evidenced by the reduced memo slots in the fixtures. [ghstack-poisoned]
- Loading branch information
Showing
92 changed files
with
415 additions
and
270 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Flags | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
paths-ignore: | ||
- 'compiler/**' | ||
|
||
jobs: | ||
flags: | ||
name: Check flags | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
- name: Restore cached node_modules | ||
uses: actions/cache@v4 | ||
id: node_modules | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn flags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: Flow | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
paths-ignore: | ||
- 'compiler/**' | ||
|
||
jobs: | ||
discover_flow_inline_configs: | ||
name: Discover flow inline configs | ||
runs-on: ubuntu-latest | ||
outputs: | ||
matrix: ${{ steps.set-matrix.outputs.result }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/github-script@v7 | ||
id: set-matrix | ||
with: | ||
script: | | ||
const inlinedHostConfigs = require('./scripts/shared/inlinedHostConfigs.js'); | ||
return inlinedHostConfigs.map(config => config.shortName); | ||
flow: | ||
name: Flow check ${{ matrix.flow_inline_config_shortname }} | ||
needs: discover_flow_inline_configs | ||
runs-on: ubuntu-latest | ||
continue-on-error: true | ||
strategy: | ||
matrix: | ||
flow_inline_config_shortname: ${{ fromJSON(needs.discover_flow_inline_configs.outputs.matrix) }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
- name: Restore cached node_modules | ||
uses: actions/cache@v4 | ||
id: node_modules | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} | ||
- run: yarn install --frozen-lockfile | ||
- run: node ./scripts/tasks/flow-ci-ghaction ${{ matrix.flow_inline_config_shortname }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
|
||
jobs: | ||
prettier: | ||
name: Run prettier | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
- name: Restore cached node_modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | ||
- run: yarn install --frozen-lockfile | ||
- run: yarn prettier-check | ||
|
||
eslint: | ||
name: Run eslint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
- name: Restore cached node_modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} | ||
- run: yarn install --frozen-lockfile | ||
- run: node ./scripts/tasks/eslint | ||
|
||
check_license: | ||
name: Check license | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
- name: Restore cached node_modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} | ||
- run: yarn install --frozen-lockfile | ||
- run: ./scripts/circleci/check_license.sh | ||
|
||
test_print_warnings: | ||
name: Test print warnings | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 18.x | ||
cache: "yarn" | ||
cache-dependency-path: yarn.lock | ||
- name: Restore cached node_modules | ||
uses: actions/cache@v4 | ||
with: | ||
path: "**/node_modules" | ||
key: ${{ runner.arch }}-${{ runner.os }}-modules-${{ hashFiles('yarn.lock') }} | ||
- run: yarn install --frozen-lockfile | ||
- run: ./scripts/circleci/test_print_warnings.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.