[llvm] [X86][NewPM] Port X86LowerAMXType to NewPM (PR #165084)
Aiden Grossman via llvm-commits
llvm-commits at lists.llvm.org
Sat Oct 25 10:50:41 PDT 2025
================
@@ -1432,8 +1434,58 @@ bool X86LowerAMXCast::transformAllAMXCast() {
return Change;
}
+bool lowerAmxType(Function &F, const TargetMachine *TM,
+ TargetLibraryInfo *TLI) {
+ // Performance optimization: most code doesn't use AMX, so return early if
+ // there are no instructions that produce AMX values. This is sufficient, as
+ // AMX arguments and constants are not allowed -- so any producer of an AMX
+ // value must be an instruction.
+ // TODO: find a cheaper way for this, without looking at all instructions.
+ if (!containsAMXCode(F))
+ return false;
+
+ bool C = false;
+ ShapeCalculator SC(TM);
+ X86LowerAMXCast LAC(F, &SC);
+ C |= LAC.combineAMXcast(TLI);
+ // There might be remaining AMXcast after combineAMXcast and they should be
+ // handled elegantly.
+ C |= LAC.transformAllAMXCast();
+
+ X86LowerAMXType LAT(F, &SC);
+ C |= LAT.visit();
+
+ // Prepare for fast register allocation at O0.
----------------
boomanaiden154 wrote:
Agreed. But it's existing and this patch only attempts to make this pass work with the NewPM, not fix and potentially latent problems.
https://github.com/llvm/llvm-project/pull/165084
More information about the llvm-commits
mailing list