[llvm] 8b7b61f - [llvm-reduce] Avoid invalid replacements with x86_amx type (#209506)

via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 14 08:05:53 PDT 2026


Author: Nikita Popov
Date: 2026-07-14T17:05:49+02:00
New Revision: 8b7b61f099616a3fbeca563b7a1da34279142797

URL: https://github.com/llvm/llvm-project/commit/8b7b61f099616a3fbeca563b7a1da34279142797
DIFF: https://github.com/llvm/llvm-project/commit/8b7b61f099616a3fbeca563b7a1da34279142797.diff

LOG: [llvm-reduce] Avoid invalid replacements with x86_amx type (#209506)

It's not possible to create zero constants of this type, and even
poison constants result in a verifier error when used as an intrinsic
argument.

Added: 
    llvm/test/tools/llvm-reduce/reduce-instructions-x86-amx.ll
    llvm/test/tools/llvm-reduce/reduce-operands-x86-amx.ll

Modified: 
    llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
    llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/test/tools/llvm-reduce/reduce-instructions-x86-amx.ll b/llvm/test/tools/llvm-reduce/reduce-instructions-x86-amx.ll
new file mode 100644
index 0000000000000..8cec17e542cce
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/reduce-instructions-x86-amx.ll
@@ -0,0 +1,13 @@
+; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=instructions --test FileCheck --test-arg --check-prefixes=CHECK,INTERESTING --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck -check-prefixes=CHECK,RESULT %s < %t
+
+; CHECK-LABEL: define <1024 x i8> @test(
+; INTERESTING: call <1024 x i8> @llvm.x86.cast.tile.to.vector
+
+; RESULT: %amx = call x86_amx @llvm.x86.cast.vector.to.tile.v1024i8(<1024 x i8> %vec)
+; RESULT: %vec2 = call <1024 x i8> @llvm.x86.cast.tile.to.vector.v1024i8(x86_amx %amx)
+define <1024 x i8> @test(<1024 x i8> %vec) {
+  %amx = call x86_amx @llvm.x86.cast.vector.to.tile.v1024i8(<1024 x i8> %vec)
+  %vec2 = call <1024 x i8> @llvm.x86.cast.tile.to.vector.v1024i8(x86_amx %amx)
+  ret <1024 x i8> %vec2
+}

diff  --git a/llvm/test/tools/llvm-reduce/reduce-operands-x86-amx.ll b/llvm/test/tools/llvm-reduce/reduce-operands-x86-amx.ll
new file mode 100644
index 0000000000000..7248ba29dfcac
--- /dev/null
+++ b/llvm/test/tools/llvm-reduce/reduce-operands-x86-amx.ll
@@ -0,0 +1,18 @@
+; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-zero --test FileCheck --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefixes=CHECK,ZERO %s < %t
+
+; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-one --test FileCheck --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefixes=CHECK,ONE %s < %t
+
+; RUN: llvm-reduce --abort-on-invalid-reduction --delta-passes=operands-poison --test FileCheck --test-arg %s --test-arg --input-file %s -o %t
+; RUN: FileCheck --check-prefixes=CHECK,POISON %s < %t
+
+; CHECK-LABEL: @test(
+; ZERO: call <1024 x i8> @llvm.x86.cast.tile.to.vector.v1024i8(x86_amx %amx)
+; ONE: call <1024 x i8> @llvm.x86.cast.tile.to.vector.v1024i8(x86_amx %amx)
+; POISON: call <1024 x i8> @llvm.x86.cast.tile.to.vector.v1024i8(x86_amx %amx)
+define <1024 x i8> @test(<1024 x i8> %vec) {
+  %amx = call x86_amx @llvm.x86.cast.vector.to.tile.v1024i8(<1024 x i8> %vec)
+  %vec2 = call <1024 x i8> @llvm.x86.cast.tile.to.vector.v1024i8(x86_amx %amx)
+  ret <1024 x i8> %vec2
+}

diff  --git a/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp b/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
index 19b69e84c2ebc..61bd9f777db36 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceInstructions.cpp
@@ -24,7 +24,8 @@ using namespace llvm;
 // TODO: Technically the verifier only enforces preallocated token usage and
 // there is a none token.
 static bool shouldAlwaysKeep(const Instruction &I) {
-  return I.isEHPad() || I.getType()->isTokenTy() || I.isSwiftError();
+  return I.isEHPad() || I.getType()->isTokenTy() ||
+         I.getType()->isX86_AMXTy() || I.isSwiftError();
 }
 
 /// Removes out-of-chunk arguments from functions, and modifies their calls

diff  --git a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
index a85131e6e01dd..b954578859593 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceOperands.cpp
@@ -62,7 +62,7 @@ static bool isZeroOrOneFP(Value *Op) {
 
 static bool shouldReduceOperand(Use &Op) {
   Type *Ty = Op->getType();
-  if (Ty->isLabelTy() || Ty->isMetadataTy())
+  if (Ty->isLabelTy() || Ty->isMetadataTy() || Ty->isX86_AMXTy())
     return false;
   // TODO: be more precise about which GEP operands we can reduce (e.g. array
   // indexes)


        


More information about the llvm-commits mailing list