Make use of the instruction folder.
authorSteven Perron <stevenperron@google.com>
Fri, 2 Feb 2018 16:55:05 +0000 (11:55 -0500)
committerSteven Perron <stevenperron@google.com>
Thu, 8 Feb 2018 04:01:47 +0000 (23:01 -0500)
commit06cdb96984a347af5a670dc6b8bfc6533526eb11
tree5fe04483e0580bde051b89ea3cb8f489120a1693
parenta61e4c13562ae65663eaa5d3b7539b80d9822084
Make use of the instruction folder.

Implementation of the simplification pass.

- Create pass that calls the instruction folder on each instruction and
  propagate instructions that fold to a copy.  This will do copy
  propagation as well.

- Did not use the propagator engine because I want to modify the instruction
  as we go along.

- Change folding to not allocate new instructions, but make changes in
  place.  This change had a big impact on compile time.

- Add simplification pass to the legalization passes in place of
  insert-extract elimination.

- Added test cases for new folding rules.

- Added tests for the simplification pass

- Added a method to the CFG to apply a function to the basic blocks in
  reverse post order.

Contributes to #1164.
16 files changed:
Android.mk
include/spirv-tools/optimizer.hpp
source/opt/CMakeLists.txt
source/opt/cfg.cpp
source/opt/cfg.h
source/opt/dead_insert_elim_pass.h
source/opt/fold.cpp
source/opt/fold.h
source/opt/folding_rules.cpp
source/opt/optimizer.cpp
source/opt/simplification_pass.cpp [new file with mode: 0644]
source/opt/simplification_pass.h [new file with mode: 0644]
test/opt/CMakeLists.txt
test/opt/fold_test.cpp
test/opt/simplification_test.cpp [new file with mode: 0644]
tools/opt/opt.cpp