Skip to content

Commit d853ade

Browse files
authored
[MIR] Fix return value when computed properties conflict with given prop (#109923)
This fixes a test failure when expensive checks are enabled. Use the correct return value when computing machine function properties resulted in an error (e.g. when conflicting with explicitly set values). Without this, the machine verifier would crash even in the presence of parsing errors which should have gently terminated execution.
1 parent 850ee79 commit d853ade

File tree

5 files changed

+47
-37
lines changed

5 files changed

+47
-37
lines changed

llvm/lib/CodeGen/MIRParser/MIRParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,10 +625,10 @@ MIRParserImpl::initializeMachineFunction(const yaml::MachineFunction &YamlMF,
625625
MRI.freezeReservedRegs();
626626

627627
if (computeFunctionProperties(MF, YamlMF))
628-
return false;
628+
return true;
629629

630630
if (initializeCallSiteInfo(PFS, YamlMF))
631-
return false;
631+
return true;
632632

633633
setupDebugValueTracking(MF, PFS, YamlMF);
634634

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s
2+
3+
# Test that computed properties are not conflicting with explicitly set
4+
# properties
5+
6+
---
7+
# CHECK: error: {{.*}}: TestIsSSAOverrideConflict has explicit property IsSSA, but is not valid SSA
8+
name: TestIsSSAOverrideConflict
9+
isSSA: true
10+
body: |
11+
bb.0:
12+
%0:_(s32) = G_IMPLICIT_DEF
13+
%0:_(s32) = G_IMPLICIT_DEF
14+
...
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s
2+
3+
# Test that computed properties are not conflicting with explicitly set
4+
# properties
5+
6+
---
7+
# CHECK: error: {{.*}}: TestNoPhisOverrideConflict has explicit property NoPhi, but contains at least one PHI
8+
name: TestNoPhisOverrideConflict
9+
noPhis: true
10+
tracksRegLiveness: true
11+
body: |
12+
bb.0:
13+
%0:_(s32) = G_IMPLICIT_DEF
14+
15+
bb.1:
16+
%1:_(s32) = PHI %0, %bb.0, %1, %bb.1
17+
G_BR %bb.1
18+
...
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# RUN: not llc -run-pass none -o /dev/null %s 2>&1 | FileCheck %s
2+
3+
# Test that computed properties are not conflicting with explicitly set
4+
# properties
5+
6+
---
7+
# CHECK: error: {{.*}}: TestNoVRegsOverrideConflict has explicit property NoVRegs, but contains virtual registers
8+
name: TestNoVRegsOverrideConflict
9+
noVRegs: true
10+
body: |
11+
bb.0:
12+
%0:_(s32) = G_IMPLICIT_DEF
13+
...

llvm/test/CodeGen/MIR/Generic/machine-function-optionally-computed-properties-conflict.mir

Lines changed: 0 additions & 35 deletions
This file was deleted.

0 commit comments

Comments
 (0)