Do not insert Phi nodes in CCP propagator.
authorDiego Novillo <dnovillo@google.com>
Wed, 3 Jan 2018 17:38:21 +0000 (12:38 -0500)
committerDiego Novillo <dnovillo@google.com>
Wed, 3 Jan 2018 20:12:25 +0000 (15:12 -0500)
commit135150a1a85e5b516a7ec299ba3b8f8513f2bc0b
tree60aef3ba4c17db0869177c814cf2e1e48d7a6576
parent25d396b4a29fd9bd09478c8045ec4d72af0d4ca9
Do not insert Phi nodes in CCP propagator.

In CCP we should not need to insert Phi nodes because CCP never looks at
loads/stores.  This required adjusting two tests that relied on Phi
instructions being inserted.  I changed the tests to have the Phi
instructions pre-inserted.

I also added a new test to make sure that CCP does not try to look
through stores and loads.

Finally, given that CCP does not handle loads/stores, it's better to run
mem2reg before it.  I've changed the -O/-Os schedules to run local
multi-store elimination before CCP.

Although this is just an efficiency fix for CCP, it is
also working around a bug in Phi insertion.  When Phi instructions are
inserted, they are never associated a basic block.  This causes a
segfault when the propagator tries to lookup CFG edges when analyzing
Phi instructions.
source/opt/ccp_pass.cpp
source/opt/optimizer.cpp
test/opt/ccp_test.cpp