Fix constant propagation of induction variables.
authorDiego Novillo <dnovillo@google.com>
Mon, 8 Jan 2018 16:56:57 +0000 (11:56 -0500)
committerDiego Novillo <dnovillo@google.com>
Mon, 8 Jan 2018 20:34:35 +0000 (15:34 -0500)
commite5560d64de40bcc52b38ee44fd8a0bbc42f64399
treed8e94a346116751f91ce16f7c26d5b4167527b89
parenta82a0ea886f59f1987f339b05cca71cc248adc78
Fix constant propagation of induction variables.

This fixes https://github.com/KhronosGroup/SPIRV-Tools/issues/1143.
When an instruction transitions from constant to bottom (varying) in the
lattice, we were telling the propagator that the instruction was
varying, but never updating the actual value in the values table.

This led to incorrect value substitutions at the end of propagation.

The patch also re-enables CCP in -O and -Os.
source/opt/ccp_pass.cpp
source/opt/ccp_pass.h
source/opt/optimizer.cpp
source/opt/propagator.cpp
source/opt/propagator.h
test/opt/ccp_test.cpp