We have some odd redundancy where clang specially handles
the stack size case. If clang prints it, the source location is first
followed by "warning". The backend diagnostic, as printed by other tools
puts "warning" first.
Details
Diff Detail
Event Timeline
This is basically LGTM from my perspective. I'd suggest getting some feedback from someone who works more on this part of Clang before landing, but I think it fixes the inconsistency nicely.
clang/test/Misc/backend-resource-limit-diagnostics.hip | ||
---|---|---|
1 | Does this need // REQUIRES: amdgpu-registered-target, like the test in backend-resourse-limit-diagnostics.cl? | |
2 | Is this planned for this patch? or for future refactoring in multiple tests? |
clang/test/Misc/backend-resource-limit-diagnostics.hip | ||
---|---|---|
2 | I'm not sure. I currently cannot comprehend why this flag exists. It's only used in a handful of tests, and its effect seems to be to just create an edge case to crash codegen when there's no target streamer |
clang/test/Misc/backend-resource-limit-diagnostics.hip | ||
---|---|---|
2 | A little more digging suggests this is a feature that is only properly implemented for 5/24 targets. Still don't really see the point |
the reason clang tries to handle diagnostics is to be able to actually print the source code as context which is nice. but of course we can't do that without clang so there's a default handler
If clang prints it, the source location is first followed by "warning". The backend diagnostic, as printed by other tools puts "warning" first.
It looks like the backend diagnostic doesn't even print the location?
llvm/include/llvm/IR/DiagnosticInfo.h | ||
---|---|---|
356 | any reason for moving this code? it makes it hard to see the diff | |
llvm/lib/IR/DiagnosticInfo.cpp | ||
76 | we should guard this with isLocationAvailable(), the <unknown>:0:0 isn't very useful |
I think you may also need to rebase, both the X86/warn-stack.ll and ARM/warn-stack.ll were recently updated to reflect changes in the backend diagnostics.
clang/test/Misc/backend-resource-limit-diagnostics.hip | ||
---|---|---|
2 | I think it's ideal for testing diagnostics in the backend, where you need codegen to occur but the actual output is unnecessary. IIUC this flag allows you to avoid using a non-portable way to throw away the output instead of redirecting to /dev/null. |
That's the point of this patch, to fix it for this case. There are still other remarks which don't
clang/test/Misc/backend-resource-limit-diagnostics.hip | ||
---|---|---|
1 | -emit-codegen-only is preferred to -S -o /dev/null |
Does this need // REQUIRES: amdgpu-registered-target, like the test in backend-resourse-limit-diagnostics.cl?