[PATCH] D104148: WIP: [LoopUtils] Fix incorrect runtimechecks

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 14 07:33:20 PDT 2021


fhahn added a comment.

Thanks for the patch. Some comments inline



================
Comment at: llvm/lib/Transforms/Utils/LoopUtils.cpp:1538
 
-  if (SE->isLoopInvariant(Sc, TheLoop)) {
+  if (SE->isLoopInvariant(Sc, TheLoop) && CG->Members.size() == 1) {
     LLVM_DEBUG(dbgs() << "LAA: Adding RT check for a loop invariant ptr:"
----------------
Can we instead directly check if  `CG->Low == Sc` and `CG->High == SC + 1`, which is the assumption for the check that is generated?

As an additional test case, could you add a case where we have 2 invariant members with the same addresses, if that's possible?


================
Comment at: llvm/test/Transforms/LoopVectorize/pr50686.ll:4
 
 @k = common dso_local local_unnamed_addr global i32 0, align 4
 
----------------
is this needed?


================
Comment at: llvm/test/Transforms/LoopVectorize/pr50686.ll:91
   %i = load i32, i32* @k, align 4
   %cmp32 = icmp slt i32 %i, %q
   br i1 %cmp32, label %for.body.preheader, label %for.cond2.preheader
----------------
unneeded? Might be good to reduce/clean-up the IR a bit.


================
Comment at: llvm/test/Transforms/LoopVectorize/pr50686.ll:105
 
 for.body:                                         ; preds = %for.body, %for.body.preheader
   %i1 = phi i32 [ %inc, %for.body ], [ %i, %for.body.preheader ]
----------------
is this needed?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D104148/new/

https://reviews.llvm.org/D104148



More information about the llvm-commits mailing list