================
@@ -7166,7 +7166,8 @@ SDValue DAGCombiner::visitAND(SDNode *N) {
 
   // if (and x, c) is known to be zero, return 0
   unsigned BitWidth = VT.getScalarSizeInBits();
-  ConstantSDNode *N1C = isConstOrConstSplat(N1);
+  ConstantSDNode *N1C =
+      isConstOrConstSplat(N1, /*AllowUndef*/ false, /*AllowTrunc*/ true);
----------------
RKSimon wrote:

we could replace this with something like:
```cpp
std::optional<APInt> N1C;
if (ConstantSDNode *C1 = isConstOrConstSplat(N1, /*AllowUndef*/ false, 
/*AllowTrunc*/ true))
  N1C = C1->getAPIntValue().zextOrTrunc(BitWidth);
```
WDYT?

https://github.com/llvm/llvm-project/pull/133915
_______________________________________________
llvm-branch-commits mailing list
llvm-branch-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits

Reply via email to