diff options
author | Philip Reames <listmail@philipreames.com> | 2019-04-01 16:26:08 +0000 |
---|---|---|
committer | Philip Reames <listmail@philipreames.com> | 2019-04-01 16:26:08 +0000 |
commit | 05e3e554b47aee32588ec30fbf0d64db6a438ab8 (patch) | |
tree | b76dc88c88b28472a3661f883bb66b888d7f97bf /llvm/lib/Transforms/Scalar/LoopPredication.cpp | |
parent | 6c21ccd245bb89134a296a5ccf74ef2a5158f6e9 (diff) | |
download | llvm-05e3e554b47aee32588ec30fbf0d64db6a438ab8.zip llvm-05e3e554b47aee32588ec30fbf0d64db6a438ab8.tar.gz llvm-05e3e554b47aee32588ec30fbf0d64db6a438ab8.tar.bz2 |
[LoopPred] Be uniform about proving generated conditions
We'd been optimizing the case where the predicate was obviously true, do the same for the false case. Mostly just for completeness sake, but also may improve compile time in loops which will exit through the guard. Such loops are presumed rare in fastpath code, but may be present down untaken paths, so optimizing for them is still useful.
llvm-svn: 357408
Diffstat (limited to 'llvm/lib/Transforms/Scalar/LoopPredication.cpp')
-rw-r--r-- | llvm/lib/Transforms/Scalar/LoopPredication.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/LoopPredication.cpp b/llvm/lib/Transforms/Scalar/LoopPredication.cpp index 6257f41..ccecc80 100644 --- a/llvm/lib/Transforms/Scalar/LoopPredication.cpp +++ b/llvm/lib/Transforms/Scalar/LoopPredication.cpp @@ -396,6 +396,9 @@ Value *LoopPredication::expandCheck(SCEVExpander &Expander, if (SE->isLoopEntryGuardedByCond(L, Pred, LHS, RHS)) return Builder.getTrue(); + if (SE->isLoopEntryGuardedByCond(L, ICmpInst::getInversePredicate(Pred), + LHS, RHS)) + return Builder.getFalse(); Instruction *InsertAt = &*Builder.GetInsertPoint(); Value *LHSV = Expander.expandCodeFor(LHS, Ty, InsertAt); |