[llvm] [CVP] Propagate constant range on icmp at use level (PR #73767)
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 13 03:23:43 PST 2023
================
@@ -294,12 +294,20 @@ static bool processICmp(ICmpInst *Cmp, LazyValueInfo *LVI) {
/// information is sufficient to prove this comparison. Even for local
/// conditions, this can sometimes prove conditions instcombine can't by
/// exploiting range information.
-static bool constantFoldCmp(CmpInst *Cmp, LazyValueInfo *LVI) {
- Value *Op0 = Cmp->getOperand(0);
- Value *Op1 = Cmp->getOperand(1);
- LazyValueInfo::Tristate Result =
- LVI->getPredicateAt(Cmp->getPredicate(), Op0, Op1, Cmp,
- /*UseBlockValue=*/true);
+/// LHSRange and RHSRange are calculated in constantFoldCmp.
+static bool constantFoldCmp(CmpInst *Cmp, LazyValueInfo *LVI,
+ ConstantRange &LHSRange, ConstantRange &RHSRange) {
+ Use &Op0 = Cmp->getOperandUse(0);
+ Use &Op1 = Cmp->getOperandUse(1);
+
+ LazyValueInfo::Tristate Result;
+ // NOTE: Now getPredicateAtUse only supports integer type.
+ if (Op0->getType()->isIntegerTy())
----------------
dtcxzyw wrote:
Does it support integer vectors?
https://github.com/llvm/llvm-project/pull/73767
More information about the llvm-commits
mailing list