Skip to content

Commit 8b1b13b

Browse files
committed
Change setting logic, include full error message, use G_IMPLICIT_DEF
1 parent 0bbb60d commit 8b1b13b

File tree

2 files changed

+10
-28
lines changed

2 files changed

+10
-28
lines changed

llvm/lib/CodeGen/MIRParser/MIRParser.cpp

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -406,27 +406,12 @@ bool MIRParserImpl::computeFunctionProperties(
406406
auto ComputedPropertyHelper =
407407
[&Properties](std::optional<bool> ExplicitProp, bool ComputedProp,
408408
MachineFunctionProperties::Property P) -> bool {
409-
// Prefer whatever is set explicitly by the input MIR
410-
if (ExplicitProp.has_value()) {
411-
if (*ExplicitProp) {
412-
// Check for conflicts with the computed value
413-
if (!ComputedProp)
414-
return true;
415-
416-
Properties.set(P);
417-
} else
418-
Properties.reset(P);
419-
420-
return false;
421-
}
422-
423-
// No explicit value given, so use computed value
424-
if (ComputedProp)
409+
if (ExplicitProp.value_or(ComputedProp))
425410
Properties.set(P);
426411
else
427412
Properties.reset(P);
428-
429-
return false;
413+
414+
return ExplicitProp && *ExplicitProp && !ComputedProp;
430415
};
431416

432417
if (ComputedPropertyHelper(YamlMF.NoPHIs, !HasPHI,

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

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,32 @@
44
# properties
55

66
---
7-
# CHECK-LABEL: TestNoPhisOverrideConflict
8-
# CHECK-SAME: has explicit property NoPhi, but contains at least one PHI
7+
# CHECK: error: {{.*}}: TestNoPhisOverrideConflict has explicit property NoPhi, but contains at least one PHI
98
name: TestNoPhisOverrideConflict
109
noPhis: true
1110
tracksRegLiveness: true
1211
body: |
1312
bb.0:
14-
%0:_(s32) = IMPLICIT_DEF
13+
%0:_(s32) = G_IMPLICIT_DEF
1514
1615
bb.1:
1716
%1:_(s32) = PHI %0, %bb.0, %1, %bb.1
1817
G_BR %bb.1
1918
...
2019
---
21-
# CHECK-LABEL: TestIsSSAOverrideConflict
22-
# CHECK-SAME: has explicit property IsSSA, but is not valid SSA
20+
# CHECK: error: {{.*}}: TestIsSSAOverrideConflict has explicit property IsSSA, but is not valid SSA
2321
name: TestIsSSAOverrideConflict
2422
isSSA: true
2523
body: |
2624
bb.0:
27-
%0:_(s32) = IMPLICIT_DEF
28-
%0:_(s32) = IMPLICIT_DEF
25+
%0:_(s32) = G_IMPLICIT_DEF
26+
%0:_(s32) = G_IMPLICIT_DEF
2927
...
3028
---
31-
# CHECK-LABEL: TestNoVRegsOverrideConflict
32-
# CHECK-SAME: has explicit property NoVRegs, but contains virtual registers
29+
# CHECK: error: {{.*}}: TestNoVRegsOverrideConflict has explicit property NoVRegs, but contains virtual registers
3330
name: TestNoVRegsOverrideConflict
3431
noVRegs: true
3532
body: |
3633
bb.0:
37-
%0:_(s32) = IMPLICIT_DEF
34+
%0:_(s32) = G_IMPLICIT_DEF
3835
...

0 commit comments

Comments
 (0)