[llvm] [AArch64] Fall back to SelectionDAG ISel if GISel is not feasible. (PR #196343)

David Green via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 06:11:19 PDT 2026


================
@@ -613,7 +599,14 @@ bool AArch64CallLowering::fallBackToDAGISel(const MachineFunction &MF) const {
       Attrs.hasStreamingCompatibleInterface())
     return true;
 
-  return false;
+  // Enable GlobalISel when feasible and when:
+  // * Forced by option to enable gisel
+  // * The current opt-level is supported by EnableGlobalISelAtO
+  // * The function is an optnone function.
+  auto OptLevel = MF.getTarget().getOptLevel();
+  return !(getCGPassBuilderOption().EnableGlobalISelOption.value_or(false) ||
+           static_cast<unsigned>(OptLevel) <= TM.getEnableGlobalISelAtO() ||
+           F.hasOptNone());
----------------
davemgreen wrote:

This function is fallBackToDAGISel so I think about it the other way - return true if we should be falling back. It is likely not great either way, but my suggestion was an attempt to simplify it. The named variables, more like the previous version, might help make it clearer but the comment is likely enough.

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


More information about the llvm-commits mailing list