[llvm] [GlobalISel][RISCV] Use constant pool for large integer constants. (PR #81101)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 8 00:06:13 PST 2024


================
@@ -182,7 +185,13 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
     CTPOPActions.maxScalar(0, sXLen).scalarSameSizeAs(1, 0).lower();
   }
 
-  getActionDefinitionsBuilder({G_CONSTANT, G_IMPLICIT_DEF})
+  auto &ConstantActions = getActionDefinitionsBuilder(G_CONSTANT);
+  if (ST.is64Bit())
+    ConstantActions.customFor({s64});
+  ConstantActions.legalFor({s32, p0}).widenScalarToNextPow2(0).clampScalar(
+      0, s32, sXLen);
----------------
arsenm wrote:

should prefer the legal actions first, then custom 

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


More information about the llvm-commits mailing list