Switch the constant expression speculation cost evaluation away from
authorChandler Carruth <chandlerc@gmail.com>
Thu, 24 Jan 2013 11:53:01 +0000 (11:53 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Thu, 24 Jan 2013 11:53:01 +0000 (11:53 +0000)
commit681add7a63b44249fd0fd38e63f10f18d6e99e38
tree19fb84b5126a5602e0047286653fe3f20d913ff7
parent2c107a80206056cdc8c2c7cb715ff9e1db64add9
Switch the constant expression speculation cost evaluation away from
a cost fuction that seems both a bit ad-hoc and also poorly suited to
evaluating constant expressions.

Notably, it is missing any support for trivial expressions such as
'inttoptr'. I could fix this routine, but it isn't clear to me all of
the constraints its other users are operating under.

The core protection that seems relevant here is avoiding the formation
of a select instruction wich a further chain of select operations in
a constant expression operand. Just explicitly encode that constraint.

Also, update the comments and organization here to make it clear where
this needs to go -- this should be driven off of real cost measurements
which take into account the number of constants expressions and the
depth of the constant expression tree.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@173340 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Transforms/Utils/SimplifyCFG.cpp
test/Transforms/SimplifyCFG/SpeculativeExec.ll