[llvm] [X86] Skip AMX type lowering when AMX is not used (PR #92910)

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Wed May 22 00:03:17 PDT 2024


================
@@ -1230,6 +1238,14 @@ class X86LowerAMXTypeLegacyPass : public FunctionPass {
   }
 
   bool runOnFunction(Function &F) override {
+    // 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))
----------------
phoebewang wrote:

We have a couple passes handling AMX. Can this be done in an analysis pass and reuse the result else where?

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


More information about the llvm-commits mailing list