@@ -1158,24 +1158,26 @@ GCNTargetMachine::createMachineScheduler(MachineSchedContext *C) const {
11581158
11591159ScheduleDAGInstrs *
11601160GCNTargetMachine::createPostMachineScheduler (MachineSchedContext *C) const {
1161- Attribute PostRADirectionAttr =
1162- C->MF ->getFunction ().getFnAttribute (" amdgpu-post-ra-direction" );
1163-
1164- if (PostRADirectionAttr.isValid ()) {
1165- StringRef PostRADirectionStr = PostRADirectionAttr.getValueAsString ();
1166- if (PostRADirectionStr == " topdown" )
1167- PostRADirection = MISched::TopDown;
1168- else if (PostRADirectionStr == " bottomup" )
1169- PostRADirection = MISched::BottomUp;
1170- else if (PostRADirectionStr == " bidirectional" )
1171- PostRADirection = MISched::Bidirectional;
1172- else {
1173- PostRADirection = MISched::Unspecified;
1174- DiagnosticInfoOptimizationFailure Diag (
1175- C->MF ->getFunction (), C->MF ->getFunction ().getSubprogram (),
1176- Twine (" invalid value for postRa direction attribute: '" ) +
1177- PostRADirectionStr);
1178- C->MF ->getFunction ().getContext ().diagnose (Diag);
1161+ if (PostRADirection.getNumOccurrences () == 0 ) {
1162+ Attribute PostRADirectionAttr =
1163+ C->MF ->getFunction ().getFnAttribute (" amdgpu-post-ra-direction" );
1164+
1165+ if (PostRADirectionAttr.isValid ()) {
1166+ StringRef PostRADirectionStr = PostRADirectionAttr.getValueAsString ();
1167+ if (PostRADirectionStr == " topdown" )
1168+ PostRADirection = MISched::TopDown;
1169+ else if (PostRADirectionStr == " bottomup" )
1170+ PostRADirection = MISched::BottomUp;
1171+ else if (PostRADirectionStr == " bidirectional" )
1172+ PostRADirection = MISched::Bidirectional;
1173+ else {
1174+ PostRADirection = MISched::Unspecified;
1175+ DiagnosticInfoOptimizationFailure Diag (
1176+ C->MF ->getFunction (), C->MF ->getFunction ().getSubprogram (),
1177+ Twine (" invalid value for postRa direction attribute: '" ) +
1178+ PostRADirectionStr);
1179+ C->MF ->getFunction ().getContext ().diagnose (Diag);
1180+ }
11791181 }
11801182 }
11811183
0 commit comments