[llvm] [msan] Generalize handlePairwiseShadowOrIntrinsic, and handle x86 pairwise add/sub (PR #127567)

Florian Mayer via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 18 10:58:23 PST 2025


================
@@ -2618,28 +2625,56 @@ struct MemorySanitizerVisitor : public InstVisitor<MemorySanitizerVisitor> {
     FixedVectorType *ParamType =
         cast<FixedVectorType>(I.getArgOperand(0)->getType());
     if (I.arg_size() == 2)
-      assert(ParamType == cast<FixedVectorType>(I.getArgOperand(1)->getType()));
+      assert(I.getArgOperand(0)->getType() == I.getArgOperand(1)->getType());
+
     [[maybe_unused]] FixedVectorType *ReturnType =
         cast<FixedVectorType>(I.getType());
     assert(ParamType->getNumElements() * I.arg_size() ==
            2 * ReturnType->getNumElements());
 
     IRBuilder<> IRB(&I);
-    unsigned Width = ParamType->getNumElements() * I.arg_size();
+
+    unsigned TotalNumElems = ParamType->getNumElements() * I.arg_size();
+    FixedVectorType *ReinterpretShadowTy = nullptr;
+    if (ReinterpretElemWidth.has_value()) {
+      assert(ParamType->getPrimitiveSizeInBits() %
+                 ReinterpretElemWidth.value() ==
----------------
fmayer wrote:

IMO the `value` calls create clutter. I would recommend using `*`

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


More information about the llvm-commits mailing list