[llvm] [ValueTracking] Extend LHS/RHS with matching operand to work without constants. (PR #85557)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 17 23:07:14 PDT 2024


================
@@ -8729,11 +8729,30 @@ static std::optional<bool> isImpliedCondICmps(const ICmpInst *LHS,
     }
   }
 
-  // Can we infer anything when the 0-operands match and the 1-operands are
-  // constants (not necessarily matching)?
-  const APInt *LC, *RC;
-  if (L0 == R0 && match(L1, m_APInt(LC)) && match(R1, m_APInt(RC)))
-    return isImpliedCondCommonOperandWithConstants(LPred, *LC, RPred, *RC);
+  // See if we can infer anything if operand-0 matches and we have at least one
+  // constant.
+  const APInt *Unused;
+  if (L0 == R0 && L0->getType()->isIntOrIntVectorTy() &&
----------------
dtcxzyw wrote:

```suggestion
  if (L0 == R0 &&
```
Unnecessary check.

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


More information about the llvm-commits mailing list