Change IRContext::KillInst to delete instructions.
authorSteven Perron <stevenperron@google.com>
Tue, 21 Nov 2017 19:47:46 +0000 (14:47 -0500)
committerSteven Perron <stevenperron@google.com>
Mon, 4 Dec 2017 16:07:45 +0000 (11:07 -0500)
commit65046eca7c52c20346a0f12e77bbd57aa95dee59
tree7c4527f8f8f7caed0c36fed02abc497eeee957c5
parentb35b52f97b13769f643dec7efad1e18d3064a345
Change IRContext::KillInst to delete instructions.

The current method of removing an instruction is to call ToNop.  The
problem with this is that it leaves around an instruction that later
passes will look at.  We should just delete the instruction.

In MemPass there is a utility routine called DCEInst.  It can delete
essentially any instruction, which can invalidate pointers now that they
are actually deleted.  The interface was changed to add a call back that
can be used to update any local data structures that contain
ir::Intruction*.
28 files changed:
source/link/linker.cpp
source/opt/aggressive_dead_code_elim_pass.cpp
source/opt/aggressive_dead_code_elim_pass.h
source/opt/basic_block.h
source/opt/common_uniform_elim_pass.cpp
source/opt/common_uniform_elim_pass.h
source/opt/dead_branch_elim_pass.cpp
source/opt/eliminate_dead_constant_pass.cpp
source/opt/fold_spec_constant_op_and_composite_pass.cpp
source/opt/insert_extract_elim.cpp
source/opt/instruction.cpp
source/opt/instruction.h
source/opt/instruction_list.h
source/opt/ir_context.cpp
source/opt/ir_context.h
source/opt/local_access_chain_convert_pass.cpp
source/opt/local_access_chain_convert_pass.h
source/opt/local_single_block_elim_pass.cpp
source/opt/local_single_store_elim_pass.cpp
source/opt/local_ssa_elim_pass.cpp
source/opt/mem_pass.cpp
source/opt/mem_pass.h
source/opt/merge_return_pass.cpp
source/opt/module.cpp
source/opt/remove_duplicates_pass.cpp
source/opt/strength_reduction_pass.cpp
source/opt/unify_const_pass.cpp
test/opt/def_use_test.cpp