Skip to content

Commit 66e0498

Browse files
authored
[GlobalISel] Do not run verifier after ResetMachineFunctionPass (llvm#124799)
After we fall back from GlobalISel to SDAG, the verifier gets called, which calls getReservedRegs which uses SIMachineFunctionInfo::usesAGPRs which caches the result of UsesAGPRs. Because we have just fallen-back the function is empty and it incorrectly gets cached to false. This patch makes sure we don't try to run the verifier whilst the function is empty.
1 parent 983562d commit 66e0498

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

llvm/lib/CodeGen/TargetPassConfig.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,11 +1039,13 @@ bool TargetPassConfig::addCoreISelPasses() {
10391039

10401040
if (addGlobalInstructionSelect())
10411041
return true;
1042+
}
10421043

1043-
// Pass to reset the MachineFunction if the ISel failed.
1044+
// Pass to reset the MachineFunction if the ISel failed. Outside of the above
1045+
// if so that the verifier is not added to it.
1046+
if (Selector == SelectorType::GlobalISel)
10441047
addPass(createResetMachineFunctionPass(
10451048
reportDiagnosticWhenGlobalISelFallback(), isGlobalISelAbortEnabled()));
1046-
}
10471049

10481050
// Run the SDAG InstSelector, providing a fallback path when we do not want to
10491051
// abort on not-yet-supported input.

llvm/test/CodeGen/AMDGPU/llvm.amdgcn.mfma.gfx950.ll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 4
22
; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -global-isel=0 < %s | FileCheck -enable-var-scope --check-prefixes=GCN,SDAG %s
3-
; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -global-isel=1 -global-isel-abort=2 < %s | FileCheck -enable-var-scope --check-prefixes=GCN,GISEL %s
3+
; RUN: llc -mtriple=amdgcn -mcpu=gfx950 -global-isel=1 -global-isel-abort=2 -verify-machineinstrs < %s | FileCheck -enable-var-scope --check-prefixes=GCN,GISEL %s
44

55
declare <4 x float> @llvm.amdgcn.mfma.f32.16x16x32.f16(<8 x half>, <8 x half>, <4 x float>, i32 immarg, i32 immarg, i32 immarg)
66
declare <16 x float> @llvm.amdgcn.mfma.f32.32x32x16.f16(<8 x half>, <8 x half>, <16 x float>, i32 immarg, i32 immarg, i32 immarg)

0 commit comments

Comments
 (0)