[PATCH] D77808: [SCCP] Use conditional info with AND/OR branch conditions.

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 5 13:52:16 PDT 2020


nikic added inline comments.


================
Comment at: llvm/lib/Transforms/Scalar/SCCP.cpp:1320
+        else
+          NewCR = NewCR.intersectWith(CopyOfCR);
 
----------------
I'd write this as:
```
NewCR = NewCR.intersectWith(CopyOfCR);
if (!CopyOfCR.contains(NewCR) &&
    CopyOfCR.getSingleMissingElement() &&
    CopyOf != OriginalVal)
  NewCR = CopyOfCR;
```
There is no need to discard the intersection if it is smaller than the original range. E.g. if you had information for `ne 0` before, then intersecting it with `ugt 42` will always be beneficial.

I'm also not clear on why the `CopyOf != OriginalVal` comparison is there. If we think that inequality information is more valuable, shouldn't that hold regardless of how we arrived at the inequality?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D77808





More information about the llvm-commits mailing list