[llvm] [msan] Fix shadow computation for partially undefined constant fixed-length vectors (PR #143837)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 12 10:13:32 PDT 2025


================
@@ -2086,8 +2088,26 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
       return ShadowPtr;
     }
 
-    // TODO: Partially undefined vectors are handled by the fall-through case
-    //       below (see partial-poison.ll); this causes false negatives.
+    // Check for partially undefined constant vectors
+    // TODO: scalable vectors (this is hard because we do not have IRBuilder)
+    if (isa<FixedVectorType>(V->getType()) && isa<Constant>(V) &&
+        (cast<Constant>(V))->containsUndefOrPoisonElement() &&
+        PropagateShadow && PoisonUndef) {
+      unsigned NumElems =
+          (cast<FixedVectorType>(V->getType()))->getNumElements();
----------------
fmayer wrote:

stray `(..)`?

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


More information about the llvm-commits mailing list