OSDN Git Service

[IPSCCP] Run Solve each time we resolved an undef in a function.
authorFlorian Hahn <florian.hahn@arm.com>
Tue, 17 Jul 2018 14:04:59 +0000 (14:04 +0000)
committerFlorian Hahn <florian.hahn@arm.com>
Tue, 17 Jul 2018 14:04:59 +0000 (14:04 +0000)
commit35603461c5afb7514f2439838fd8ed3226e49e1e
tree544319c59dd002c7628fea3a8f3181c59c1c484c
parent73739643d7bc75aacfd5455b37b31376ad20af25
[IPSCCP] Run Solve each time we resolved an undef in a function.

Once we resolved an undef in a function we can run Solve, which could
lead to finding a constant return value for the function, which in turn
could turn undefs into constants in other functions that call it, before
resolving undefs there.

Computationally the amount of work we are doing stays the same, just the
order we process things is slightly different and potentially there are
a few less undefs to resolve.

We are still relying on the order of functions in the IR, which means
depending on the order, we are able to resolve the optimal undef first
or not. For example, if @test1 comes before @testf, we find the constant
return value of @testf too late and we cannot use it while solving
@test1.

This on its own does not lead to more constants removed in the
test-suite, probably because currently we have to be very lucky to visit
applicable functions in the right order.

Maybe we manage to come up with a better way of resolving undefs in more
'profitable' functions first.

Reviewers: efriedma, mssimpso, davide

Reviewed By: efriedma, davide

Differential Revision: https://reviews.llvm.org/D49385

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337283 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Scalar/SCCP.cpp
test/Transforms/IPConstantProp/solve-after-each-resolving-undefs-for-function.ll [new file with mode: 0644]
test/Transforms/SCCP/ipsccp-basic.ll