[llvm-branch-commits] [llvm] [MSAN] handle AVX vpermi2var (PR #143463)

2025-06-13 Thread Florian Mayer via llvm-branch-commits

https://github.com/fmayer closed 
https://github.com/llvm/llvm-project/pull/143463
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [MSAN] handle AVX vpermi2var (PR #143463)

2025-06-13 Thread Thurston Dang via llvm-branch-commits

https://github.com/thurstond approved this pull request.


https://github.com/llvm/llvm-project/pull/143463
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [MSAN] handle AVX vpermi2var (PR #143463)

2025-06-13 Thread Thurston Dang via llvm-branch-commits


@@ -4191,6 +4191,15 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
   // We apply the same permutation (argument index 1) to the shadows.
   void handleAVXVpermil2var(IntrinsicInst &I) {
 assert(I.arg_size() == 3);
+assert(isa(I.getArgOperand(0)->getType()));
+assert(isa(I.getArgOperand(1)->getType()));
+assert(isa(I.getArgOperand(2)->getType()));
+[[maybe_unused]] auto ArgVectorSize =
+cast(I.getArgOperand(0)->getType())->getNumElements();
+assert(cast(I.getArgOperand(1)->getType())
+   ->getNumElements() == ArgVectorSize);
+assert(cast(I.getArgOperand(2)->getType())
+   ->getNumElements() == ArgVectorSize);

thurstond wrote:

Some of the assertions are redundant (e.g., if operand 0 is a vector, and 
operand 0's type is the same as operand 2's type, then operand 2 must be a 
vector with the same number of elements as operand 0), but that's fine.

https://github.com/llvm/llvm-project/pull/143463
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [MSAN] handle AVX vpermi2var (PR #143463)

2025-06-13 Thread Florian Mayer via llvm-branch-commits

https://github.com/fmayer updated 
https://github.com/llvm/llvm-project/pull/143463

>From dd6d9e4fa3dee83c1f42f62eb6342dfeb60184ee Mon Sep 17 00:00:00 2001
From: Florian Mayer 
Date: Thu, 12 Jun 2025 14:19:00 -0700
Subject: [PATCH 1/2] fmt

Created using spr 1.3.4
---
 llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 72a3409251204..e2dfcaae71ba9 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -4192,7 +4192,7 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
   void handleAVXVpermil2var(IntrinsicInst &I) {
 assert(I.arg_size() == 3);
 assert(I.getArgOperand(0)->getType() == I.getArgOperand(2)->getType());
-assert(I.getType() == I.getArgOperand(0)->getType() );
+assert(I.getType() == I.getArgOperand(0)->getType());
 assert(I.getArgOperand(1)->getType()->isIntOrIntVectorTy());
 IRBuilder<> IRB(&I);
 Value *AShadow = getShadow(&I, 0);

>From 4a6142a75f6680c2a81e52a6de65ef91ee88babc Mon Sep 17 00:00:00 2001
From: Florian Mayer 
Date: Fri, 13 Jun 2025 15:11:41 -0700
Subject: [PATCH 2/2] assert

Created using spr 1.3.4
---
 llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | 9 +
 1 file changed, 9 insertions(+)

diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index e2dfcaae71ba9..320ccaab58502 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -4191,6 +4191,15 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
   // We apply the same permutation (argument index 1) to the shadows.
   void handleAVXVpermil2var(IntrinsicInst &I) {
 assert(I.arg_size() == 3);
+assert(isa(I.getArgOperand(0)->getType()));
+assert(isa(I.getArgOperand(1)->getType()));
+assert(isa(I.getArgOperand(2)->getType()));
+[[maybe_unused]] auto ArgVectorSize =
+cast(I.getArgOperand(0)->getType())->getNumElements();
+assert(cast(I.getArgOperand(1)->getType())
+   ->getNumElements() == ArgVectorSize);
+assert(cast(I.getArgOperand(2)->getType())
+   ->getNumElements() == ArgVectorSize);
 assert(I.getArgOperand(0)->getType() == I.getArgOperand(2)->getType());
 assert(I.getType() == I.getArgOperand(0)->getType());
 assert(I.getArgOperand(1)->getType()->isIntOrIntVectorTy());

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [MSAN] handle AVX vpermi2var (PR #143463)

2025-06-12 Thread Thurston Dang via llvm-branch-commits


@@ -4187,6 +4187,29 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
 setShadow(&I, IRB.CreateBitCast(CI, getShadowTy(&I)));
 setOriginForNaryOp(I);
   }
+  // Instrument AVX permutation intrinsic.
+  // We apply the same permutation (argument index 1) to the shadows.
+  void handleAVXVpermil2var(IntrinsicInst &I) {
+assert(I.arg_size() == 3);
+assert(I.getArgOperand(0)->getType() == I.getArgOperand(2)->getType());
+assert(I.getType() == I.getArgOperand(0)->getType());

thurstond wrote:

Please also check that I.getType() is a vector type, and that 
`I.getArgOperand(0)` has the same number of elements as `I.getArgOperand(1)`

https://github.com/llvm/llvm-project/pull/143463
___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits


[llvm-branch-commits] [llvm] [MSAN] handle AVX vpermi2var (PR #143463)

2025-06-12 Thread Florian Mayer via llvm-branch-commits

https://github.com/fmayer updated 
https://github.com/llvm/llvm-project/pull/143463

>From dd6d9e4fa3dee83c1f42f62eb6342dfeb60184ee Mon Sep 17 00:00:00 2001
From: Florian Mayer 
Date: Thu, 12 Jun 2025 14:19:00 -0700
Subject: [PATCH] fmt

Created using spr 1.3.4
---
 llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp 
b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
index 72a3409251204..e2dfcaae71ba9 100644
--- a/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/MemorySanitizer.cpp
@@ -4192,7 +4192,7 @@ struct MemorySanitizerVisitor : public 
InstVisitor {
   void handleAVXVpermil2var(IntrinsicInst &I) {
 assert(I.arg_size() == 3);
 assert(I.getArgOperand(0)->getType() == I.getArgOperand(2)->getType());
-assert(I.getType() == I.getArgOperand(0)->getType() );
+assert(I.getType() == I.getArgOperand(0)->getType());
 assert(I.getArgOperand(1)->getType()->isIntOrIntVectorTy());
 IRBuilder<> IRB(&I);
 Value *AShadow = getShadow(&I, 0);

___
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits