Avoid generating duplicate names when merging types
authorSteven Perron <stevenperron@google.com>
Mon, 5 Mar 2018 14:57:41 +0000 (09:57 -0500)
committerSteven Perron <31666470+s-perron@users.noreply.github.com>
Mon, 5 Mar 2018 17:02:50 +0000 (12:02 -0500)
commit9ba50e34f26cac5e6baf19cef2b646c66f4db025
treead711a6d26be2cea09eff0576a92c12e9a59957f
parent6cd6e5ebef0623a863ca2d8152edda75dd5001df
Avoid generating duplicate names when merging types

The merging types we do not remove other information related to the
types.  We simply leave it duplicated, and hope it is removed later.
This is what happens with decorations.  They are removed in the next
phase of remove duplicates.  However, for OpNames that is not the case.
We end up with two different names for the same id, which does not make
sense.

The solution is to remove the names and decorations for the type being
removed instead of rewriting them to refer to the other type.

Note that it is possible that if the first type does not have a name,
then the types will end up with no name.  That is fine because the names
should not have any semantic significance anyway.

The was identified in issue #1372, but this does not fix that issue.
source/opt/remove_duplicates_pass.cpp
test/opt/pass_remove_duplicates_test.cpp