[PATCH] D101486: [Dependence Analysis] Enable delinearization of fixed sized arrays

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 3 07:00:31 PDT 2021


fhahn added inline comments.


================
Comment at: llvm/lib/Analysis/DependenceAnalysis.cpp:3372
+        if (!isKnownNonNegative(S, Ptr))
+          FailedRangeCheck = true;
+        if (auto *SType = dyn_cast<IntegerType>(S->getType())) {
----------------
artemrad wrote:
> fhahn wrote:
> > Can these now be early exits?
> I guess you are right. In my code we will exit early as soon as we do the next iteration of the loop (see loop condition.) With your proposal we skip a few instructions, for the cost of adding brackets to the if statement. I don't know if that is worth it, and whether it will make any impact on the performance as the loop calculation is fairly lightweight. 
> 
> I don't personally have a preference, if you insist I will add a return statement there.  
My thinking was that we could get rid of the `FailedRangeCheck` variable, and just `return false` here (and `return true;` in at the ned. Then have 

```
if (!AllIndicesInRange() || !AllIndicesInRange())
...
```

It seems to me that this would simplify the code a bit and is more in line with the usual style in LLVM ( https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code)


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

https://reviews.llvm.org/D101486



More information about the llvm-commits mailing list