Commit rL347861 introduced an unintentional change in the behaviour when compiling for AArch64 at -O0 with -global-isel=0. Previously, explicitly disabling GlobalISel resulted in using FastISel but an updated condition in the commit changed it to using SelectionDAG. The patch fixes this condition and slightly better organizes the code that chooses the instruction selector.
Fixes PR40131.
Note that a fix without any cleanup would look as follows:
diff --git a/lib/CodeGen/TargetPassConfig.cpp b/lib/CodeGen/TargetPassConfig.cpp index defb165fe0f..7a1747a6ad8 100644 --- a/lib/CodeGen/TargetPassConfig.cpp +++ b/lib/CodeGen/TargetPassConfig.cpp @@ -757,7 +757,8 @@ bool TargetPassConfig::addCoreISelPasses() { TM->setO0WantsFastISel(EnableFastISelOption != cl::BOU_FALSE); if (EnableFastISelOption == cl::BOU_TRUE || (TM->getOptLevel() == CodeGenOpt::None && TM->getO0WantsFastISel() && - !TM->Options.EnableGlobalISel)) { + (EnableGlobalISelOption == cl::BOU_FALSE || + !TM->Options.EnableGlobalISel))) { TM->setFastISel(true); TM->setGlobalISel(false); }