[llvm] 6e1308b - [SCEV][NFC] Simplify check with CI->isZero() exit condition
Max Kazantsev via llvm-commits
llvm-commits at lists.llvm.org
Thu Oct 14 00:07:56 PDT 2021
Author: Max Kazantsev
Date: 2021-10-14T14:06:52+07:00
New Revision: 6e1308bc1027eb65d0d1297e4b5efa0a69d611d0
URL: https://github.com/llvm/llvm-project/commit/6e1308bc1027eb65d0d1297e4b5efa0a69d611d0
DIFF: https://github.com/llvm/llvm-project/commit/6e1308bc1027eb65d0d1297e4b5efa0a69d611d0.diff
LOG: [SCEV][NFC] Simplify check with CI->isZero() exit condition
Replace check with
if ((ExitIfTrue && CI->isZero()) || (!ExitIfTrue && CI->isOne()))
with equivalent and simpler version
if (ExitIfTrue == CI->isZero())
Added:
Modified:
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 71b67dc683b2..ec55c92e0b50 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -7829,7 +7829,7 @@ ScalarEvolution::computeBackedgeTakenCount(const Loop *L,
if (auto *BI = dyn_cast<BranchInst>(ExitBB->getTerminator()))
if (auto *CI = dyn_cast<ConstantInt>(BI->getCondition())) {
bool ExitIfTrue = !L->contains(BI->getSuccessor(0));
- if ((ExitIfTrue && CI->isZero()) || (!ExitIfTrue && CI->isOne()))
+ if (ExitIfTrue == CI->isZero())
continue;
}
More information about the llvm-commits
mailing list