[llvm] [CVP] Canonicalize signed minmax into unsigned (PR #82478)

Nikita Popov via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 21 02:47:48 PST 2024


================
@@ -528,17 +530,35 @@ static bool processAbsIntrinsic(IntrinsicInst *II, LazyValueInfo *LVI) {
 }
 
 // See if this min/max intrinsic always picks it's one specific operand.
+// If not, check whether we can canonicalize signed minmax into unsigned version
 static bool processMinMaxIntrinsic(MinMaxIntrinsic *MM, LazyValueInfo *LVI) {
   CmpInst::Predicate Pred = CmpInst::getNonStrictPredicate(MM->getPredicate());
   LazyValueInfo::Tristate Result = LVI->getPredicateAt(
       Pred, MM->getLHS(), MM->getRHS(), MM, /*UseBlockValue=*/true);
----------------
nikic wrote:

Can you please also replace this getPredicateAt() use with comparison on getConstantRangeAtUse()? It makes very little sense to do both. (getPredicateAt can be better in rare cases involving equality predicates, but it shouldn't be relevant here.)

https://github.com/llvm/llvm-project/pull/82478


More information about the llvm-commits mailing list