@@ -910,25 +910,23 @@ void DXILResourceCounterDirectionMap::populate(Module &M, DXILBindingMap &DBM) {
910
910
ResourceCounterDirection::Invalid;
911
911
std::get<ResourceCounterDirection>(*DupNext) =
912
912
ResourceCounterDirection::Invalid;
913
+
914
+ // Raise an error for every invalid entry
915
+ StringRef Message =
916
+ " RWStructuredBuffers may increment or decrement their "
917
+ " counters, but not both." ;
918
+ const Function *FFirst = std::get<const Function *>(*DupFirst);
919
+ const CallInst *CIFirst = std::get<const CallInst *>(*DupFirst);
920
+ const Function *FNext = std::get<const Function *>(*DupNext);
921
+ const CallInst *CINext = std::get<const CallInst *>(*DupNext);
922
+ M.getContext ().diagnose (DiagnosticInfoGenericWithLoc (
923
+ Message, *FFirst, CIFirst->getDebugLoc ()));
924
+ M.getContext ().diagnose (DiagnosticInfoGenericWithLoc (
925
+ Message, *FNext, CINext->getDebugLoc ()));
913
926
}
914
927
}
915
928
}
916
929
917
- // Raise an error for every invalid entry
918
- for (const auto &Entry : DiagCounterDirs) {
919
- ResourceCounterDirection Dir = std::get<ResourceCounterDirection>(Entry);
920
- const Function *F = std::get<const Function *>(Entry);
921
- const CallInst *CI = std::get<const CallInst *>(Entry);
922
-
923
- if (Dir != ResourceCounterDirection::Invalid)
924
- continue ;
925
-
926
- StringRef Message = " RWStructuredBuffers may increment or decrement their "
927
- " counters, but not both." ;
928
- M.getContext ().diagnose (
929
- DiagnosticInfoGenericWithLoc (Message, *F, CI->getDebugLoc ()));
930
- }
931
-
932
930
// Copy the results into the final vec
933
931
CounterDirections.clear ();
934
932
CounterDirections.reserve (DiagCounterDirs.size ());
0 commit comments