[PATCH] D68811: [CVP] Remove a masking operation if range information implies it's a noop

Philip Reames via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 10 12:37:17 PDT 2019


reames marked 3 inline comments as done.
reames added inline comments.


================
Comment at: lib/Transforms/Scalar/CorrelatedValuePropagation.cpp:715-716
+
+  ConstantRange LRange = LVI->getConstantRange(LHS, BB, BinOp);
+  if (!LRange.getUnsignedMax().ule(RHS->getValue()))
+    return false;
----------------
lebedev.ri wrote:
> Do we want to query constanrange, or use `getPredicateAt()`?
> Different folds here take different routes.
> Should this be:
> ```
>   if (LVI->getPredicateAt(ICmpInst::ICMP_ULE, LHS, RHS, SDI) !=
>       LazyValueInfo::True)
>     return false;
> ```
> ?  (i don't know)
In this case, I think they're basically equivalent in practice for this case.  The getPredicateAt form is slightly more powerful as it does predicate pushback through one layer of predecessors, but skipping that is slightly faster compile time wise.

Hm, having written that, I think I'll switch to the predicate form just for future proofing ad consistency.  Update coming.  


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

https://reviews.llvm.org/D68811





More information about the llvm-commits mailing list