diff options
author | Philip Reames <listmail@philipreames.com> | 2018-04-27 17:41:37 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2018-04-27 17:41:37 +0000 |
commit | de5a1da2d2c210e26ef1d46a8d0971d5570dbfe0 (patch) | |
tree | 43c11c06b9de3db153de31207d8dc5f93edcfd49 | |
parent | 9258e9d190af643ed5d770fa8a965af3b7090502 (diff) | |
download | llvm-de5a1da2d2c210e26ef1d46a8d0971d5570dbfe0.zip llvm-de5a1da2d2c210e26ef1d46a8d0971d5570dbfe0.tar.gz llvm-de5a1da2d2c210e26ef1d46a8d0971d5570dbfe0.tar.bz2 |
[GuardWidening] Add some clarifying comments about heuristics [NFC]
llvm-svn: 331061
-rw-r--r-- | llvm/lib/Transforms/Scalar/GuardWidening.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/GuardWidening.cpp b/llvm/lib/Transforms/Scalar/GuardWidening.cpp index b1d11af..92e677d 100644 --- a/llvm/lib/Transforms/Scalar/GuardWidening.cpp +++ b/llvm/lib/Transforms/Scalar/GuardWidening.cpp @@ -335,6 +335,8 @@ GuardWideningImpl::WideningScore GuardWideningImpl::computeWideningScore( bool HoistingOutOfLoop = false; if (DominatingGuardLoop != DominatedGuardLoop) { + // Be conservative and don't widen into a sibling loop. TODO: If the + // sibling is colder, we should consider allowing this. if (DominatingGuardLoop && !DominatingGuardLoop->contains(DominatedGuardLoop)) return WS_IllegalOrNegative; @@ -345,6 +347,12 @@ GuardWideningImpl::WideningScore GuardWideningImpl::computeWideningScore( if (!isAvailableAt(DominatedGuard->getArgOperand(0), DominatingGuard)) return WS_IllegalOrNegative; + // If the guard was conditional executed, it may never be reached + // dynamically. There are two potential downsides to hoisting it out of the + // conditionally executed region: 1) we may spuriously deopt without need and + // 2) we have the extra cost of computing the guard condition in the common + // case. At the moment, we really only consider the second in our heuristic + // here. TODO: evaluate cost model for spurious deopt bool HoistingOutOfIf = !PDT.dominates(DominatedGuard->getParent(), DominatingGuard->getParent()); |