[PATCH] D149409: [ValueTracking] Handle bitcasts between vec-int-ptr in `isKnownNonZero`

Nikita Popov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 29 10:01:10 PDT 2023


nikic requested changes to this revision.
nikic added inline comments.
This revision now requires changes to proceed.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2746
     if (I->getType()->isPointerTy())
       return isKnownNonZero(I->getOperand(0), Depth, Q);
+
----------------
I think this special case is subsumed by the code below, via isPtrOtPtrVectorTy.


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2750
+    // if the scalar size of elements in the operand are smaller than the size
+    // they are casting two. Take two cases:
+    //
----------------
two -> to


================
Comment at: llvm/lib/Analysis/ValueTracking.cpp:2766
+    if ((FromTy->isIntOrIntVectorTy() || FromTy->isPtrOrPtrVectorTy()) &&
+        getBitWidth(FromTy->getScalarType(), Q.DL) <= BitWidth)
+      return isKnownNonZero(I->getOperand(0), Depth, Q);
----------------
I don't think this condition is sufficient. Consider a bitcast from `<4 x i3>` to `<3 x i4>`. The new element size needs to be a multiple.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149409



More information about the llvm-commits mailing list