diff options
author | Roman Lebedev <lebedev.ri@gmail.com> | 2019-08-29 12:47:34 +0000 |
---|---|---|
committer | Roman Lebedev <lebedev.ri@gmail.com> | 2019-08-29 12:47:34 +0000 |
commit | 9f35d2b564041da3a661b763414b75a51eda9a77 (patch) | |
tree | 5dde52e57fd21f91bc9e4b4b632437213096b8cb /llvm/lib/Analysis/InstructionSimplify.cpp | |
parent | 473a063a5e1381287880e8b9c54cce901712f01d (diff) | |
download | bcm5719-llvm-9f35d2b564041da3a661b763414b75a51eda9a77.tar.gz bcm5719-llvm-9f35d2b564041da3a661b763414b75a51eda9a77.zip |
[SimplifyCFG] FoldTwoEntryPHINode(): don't bailout on i1 PHI's if we can hoist a 'not' from incoming values
Summary:
As it can be seen in the tests in D65143/D65144, even though we have formed an '@llvm.umul.with.overflow'
and got rid of potential for division-by-zero, the control flow remains, we still have that branch.
We have this condition:
```
// Don't fold i1 branches on PHIs which contain binary operators
// These can often be turned into switches and other things.
if (PN->getType()->isIntegerTy(1) &&
(isa<BinaryOperator>(PN->getIncomingValue(0)) ||
isa<BinaryOperator>(PN->getIncomingValue(1)) ||
isa<BinaryOperator>(IfCond)))
return false;
```
which was added back in rL121764 to help with `select` formation i think?
That check prevents us to flatten the CFG here, even though we know
we no longer need that guard and will be able to drop everything
but the '@llvm.umul.with.overflow' + `not`.
As it can be seen from tests, we end here because the `not` is being
sinked into the PHI's incoming values by InstCombine,
so we can't workaround this by hoisting it to after PHI.
Thus i suggest that we relax that check to not bailout if we'd get to hoist the `not`.
Reviewers: craig.topper, spatel, fhahn, nikic
Reviewed By: spatel
Subscribers: hiraditya, llvm-commits
Tags: #llvm
Differential Revision: https://reviews.llvm.org/D65147
llvm-svn: 370349
Diffstat (limited to 'llvm/lib/Analysis/InstructionSimplify.cpp')
0 files changed, 0 insertions, 0 deletions