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

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 06:46:39 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:

Good summary! Feel free to refactor other MIR passes if you are interested :)

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


More information about the llvm-commits mailing list