[PATCH] D11892: LoopVersioning: Use default LAA runtimeCheck, When input check not provided.

Adam Nemet via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 11 21:16:57 PDT 2015


anemet added inline comments.

================
Comment at: lib/Transforms/Utils/LoopVersioning.cpp:25-38
@@ -24,8 +24,16 @@
 
 LoopVersioning::LoopVersioning(
     SmallVector<RuntimePointerChecking::PointerCheck, 4> Checks,
     const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI, DominatorTree *DT)
-    : VersionedLoop(L), NonVersionedLoop(nullptr), Checks(std::move(Checks)),
-      LAI(LAI), LI(LI), DT(DT) {
+    : VersionedLoop(L), NonVersionedLoop(nullptr), LAI(LAI),
+      Checks(std::move(Checks)), LI(LI), DT(DT) {
+  assert(L->getExitBlock() && "No single exit block");
+  assert(L->getLoopPreheader() && "No preheader");
+}
+
+LoopVersioning::LoopVersioning(const LoopAccessInfo &LAI, Loop *L, LoopInfo *LI,
+                               DominatorTree *DT)
+    : VersionedLoop(L), NonVersionedLoop(nullptr), LAI(LAI),
+      Checks(LAI.getRuntimePointerChecking()->getChecks()), LI(LI), DT(DT) {
   assert(L->getExitBlock() && "No single exit block");
   assert(L->getLoopPreheader() && "No preheader");
----------------
Please don't change the order of the member variables.  It was nice how the required analyses were grouped all together.

I understand that you can't use LAI, the member, before you initialize it but you should be able to fix that by naming the parameter to the constructor differently, e.g., LAInfo or something and then use LAInfo when calling getChecks().


Repository:
  rL LLVM

http://reviews.llvm.org/D11892





More information about the llvm-commits mailing list