Skip to content

Commit 2b6aa35

Browse files
fixup! Assign ResDef if ALiasDef is non-null
1 parent 775f644 commit 2b6aa35

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

llvm/utils/TableGen/SubtargetEmitter.cpp

+12-16
Original file line numberDiff line numberDiff line change
@@ -902,21 +902,19 @@ SubtargetEmitter::FindWriteResources(const CodeGenSchedRW &SchedWrite,
902902
for (Record *WR : ProcModel.WriteResDefs) {
903903
if (!WR->isSubClassOf("WriteRes"))
904904
continue;
905-
// If there is no AliasDef and we find a match, we can early exit since
906-
// there is no need to verify whether there are resources defined for both
907-
// SchedWrite and its alias.
908905
Record *WRDef = WR->getValueAsDef("WriteType");
909-
if (!AliasDef && SchedWrite.TheDef == WRDef) {
910-
ResDef = WR;
911-
break;
912-
}
913-
if (AliasDef == WRDef) {
906+
if (AliasDef == WRDef || SchedWrite.TheDef == WRDef) {
914907
if (ResDef) {
915908
PrintFatalError(WR->getLoc(), "Resources are defined for both "
916909
"SchedWrite and its alias on processor " +
917910
ProcModel.ModelName);
918911
}
919912
ResDef = WR;
913+
// If there is no AliasDef and we find a match, we can early exit since
914+
// there is no need to verify whether there are resources defined for both
915+
// SchedWrite and its alias.
916+
if (!AliasDef)
917+
break;
920918
}
921919
}
922920
// TODO: If ProcModel has a base model (previous generation processor),
@@ -963,21 +961,19 @@ Record *SubtargetEmitter::FindReadAdvance(const CodeGenSchedRW &SchedRead,
963961
for (Record *RA : ProcModel.ReadAdvanceDefs) {
964962
if (!RA->isSubClassOf("ReadAdvance"))
965963
continue;
966-
// If there is no AliasDef and we find a match, we can early exit since
967-
// there is no need to verify whether there are resources defined for both
968-
// SchedRead and its alias.
969964
Record *RADef = RA->getValueAsDef("ReadType");
970-
if (!AliasDef && SchedRead.TheDef == RADef) {
971-
ResDef = RA;
972-
break;
973-
}
974-
if (AliasDef == RADef) {
965+
if (AliasDef == RADef || SchedRead.TheDef == RADef) {
975966
if (ResDef) {
976967
PrintFatalError(RA->getLoc(), "Resources are defined for both "
977968
"SchedRead and its alias on processor " +
978969
ProcModel.ModelName);
979970
}
980971
ResDef = RA;
972+
// If there is no AliasDef and we find a match, we can early exit since
973+
// there is no need to verify whether there are resources defined for both
974+
// SchedRead and its alias.
975+
if (!AliasDef)
976+
break;
981977
}
982978
}
983979
// TODO: If ProcModel has a base model (previous generation processor),

0 commit comments

Comments
 (0)