diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2013-01-24 12:05:17 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2013-01-24 12:05:17 +0000 |
| commit | 01bffaad03e2139524cb2a011a1a13d4e40d991d (patch) | |
| tree | bd6d10cd3ffe6135575aecebcbdf0fe195f6e147 /llvm/lib/Transforms/Utils/SimplifyCFG.cpp | |
| parent | 8a21005cca67caa0db5db584faada56e1e38627c (diff) | |
| download | llvm-01bffaad03e2139524cb2a011a1a13d4e40d991d.zip llvm-01bffaad03e2139524cb2a011a1a13d4e40d991d.tar.gz llvm-01bffaad03e2139524cb2a011a1a13d4e40d991d.tar.bz2 | |
Address a large chunk of this FIXME by accumulating the cost for
unfolded constant expressions rather than checking each one
independently.
llvm-svn: 173341
Diffstat (limited to 'llvm/lib/Transforms/Utils/SimplifyCFG.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 7ec3165..11cb25d 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1446,14 +1446,12 @@ static bool SpeculativelyExecuteBB(BranchInst *BI, BasicBlock *ThenBB) { if (Operator::getOpcode(CE) == Instruction::Select) return false; - // An unfolded ConstantExpr could end up getting expanded into - // Instructions. Don't speculate this and another instruction at - // the same time. - // FIXME: This is strange because provided we haven't already hit the cost - // of 1, this code will speculate an arbitrary number of complex constant - // expression PHI nodes. Also, this doesn't account for how complex the - // constant expression is. - if (SpeculationCost > 0) + // Account for the cost of an unfolded ConstantExpr which could end up + // getting expanded into Instructions. + // FIXME: This doesn't account for how many operations are combined in the + // constant expression. + ++SpeculationCost; + if (SpeculationCost > 1) return false; } |
