[llvm] 4d02b47 - [LAA] Add assertion to check both Start and End are invariant (NFC).

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 24 06:17:45 PDT 2023


Author: Florian Hahn
Date: 2023-07-24T15:17:18+02:00
New Revision: 4d02b472f1dc290388d8e826d52d4cc5c438612c

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

LOG: [LAA] Add assertion to check both Start and End are invariant (NFC).

Add extra assert to check invariant of RuntimePointerChecking::insert to
guard against subtle changes when extending the scope of LAA.

Added: 
    

Modified: 
    llvm/lib/Analysis/LoopAccessAnalysis.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/LoopAccessAnalysis.cpp b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
index 8b6c9ebb2b6033..fd0e81c51ac806 100644
--- a/llvm/lib/Analysis/LoopAccessAnalysis.cpp
+++ b/llvm/lib/Analysis/LoopAccessAnalysis.cpp
@@ -232,6 +232,9 @@ void RuntimePointerChecking::insert(Loop *Lp, Value *Ptr, const SCEV *PtrExpr,
       ScEnd = SE->getUMaxExpr(AR->getStart(), ScEnd);
     }
   }
+  assert(SE->isLoopInvariant(ScStart, Lp) && "ScStart needs to be invariant");
+  assert(SE->isLoopInvariant(ScEnd, Lp)&& "ScEnd needs to be invariant");
+
   // Add the size of the pointed element to ScEnd.
   auto &DL = Lp->getHeader()->getModule()->getDataLayout();
   Type *IdxTy = DL.getIndexType(Ptr->getType());


        


More information about the llvm-commits mailing list