[llvm] 4e6ec0b - [SCEV] Replace redundant !Preds.empty() check with assert. (NFCI)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 19 05:54:21 PDT 2024


Author: Florian Hahn
Date: 2024-09-19T13:53:30+01:00
New Revision: 4e6ec0bf6d488e9a38ac03cc85077ca38169c532

URL: https://github.com/llvm/llvm-project/commit/4e6ec0bf6d488e9a38ac03cc85077ca38169c532
DIFF: https://github.com/llvm/llvm-project/commit/4e6ec0bf6d488e9a38ac03cc85077ca38169c532.diff

LOG: [SCEV] Replace redundant !Preds.empty() check with assert. (NFCI)

If there are no predicates, the predicated counts should not be
different to the non-predicated ones.

Added: 
    

Modified: 
    llvm/lib/Analysis/ScalarEvolution.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index e06863b6deb902..08396350697c45 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -13734,7 +13734,8 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
 
   SmallVector<const SCEVPredicate *, 4> Preds;
   auto *PBT = SE->getPredicatedBackedgeTakenCount(L, Preds);
-  if (PBT != BTC || !Preds.empty()) {
+  if (PBT != BTC) {
+    assert(!Preds.empty() && "Different predicated BTC, but no predicates");
     OS << "Loop ";
     L->getHeader()->printAsOperand(OS, /*PrintType=*/false);
     OS << ": ";
@@ -13753,6 +13754,8 @@ static void PrintLoopInfo(raw_ostream &OS, ScalarEvolution *SE,
   auto *PredSymbolicMax =
       SE->getPredicatedSymbolicMaxBackedgeTakenCount(L, Preds);
   if (SymbolicBTC != PredSymbolicMax) {
+    assert(!Preds.empty() &&
+           "Different predicated symbolic max BTC, but no predicates");
     OS << "Loop ";
     L->getHeader()->printAsOperand(OS, /*PrintType=*/false);
     OS << ": ";


        


More information about the llvm-commits mailing list