7 Commits

Author SHA1 Message Date
Matt Arsenault
0ebd4638af clang: Improve errors for DiagnosticInfoResourceLimit
Print source location info and demangle the name, compared
to the default behavior.

Several observations:

1. Specially handling this seems to give source locations
without enabling debug info, and also gives columns compared
to the backend diagnostic.

2. We're duplicating diagnostic effort in DiagnosticInfo
and clang. This feels wrong, but clang can demangle and I guess
have better debug info available? Should clang really have any of this
code? For the purposes of this diagnostic, the important piece
is just reading the source location out of the llvm::Function.

3. lld is not duplicating the same effort as clang with LTO, and
just directly printing the DiagnosticInfo as-is. e.g.

  $ clang -fgpu-rdc
	lld: error: local memory (480000) exceeds limit (65536) in function '_Z12use_huge_ldsIiEvv'
	lld: error: local memory (960000) exceeds limit (65536) in function '_Z12use_huge_ldsIdEvv'

  $ clang -fno-gpu-rdc
	backend-resource-limit-diagnostics.hip:8:17: error: local memory (480000) exceeds limit (65536) in 'void use_huge_lds<int>()'
	__global__ void use_huge_lds() {
                ^
	backend-resource-limit-diagnostics.hip:8:17: error: local memory (960000) exceeds limit (65536) in 'void use_huge_lds<double>()'
	2 errors generated when compiling for gfx90a.

4. Backend errors are not observed with -save-temps and -fno-gpu-rdc or -flto,
and the compile incorrectly succeeds.

5. The backend version prints error: <location info>; clang prints <location info>: error:

6. -emit-codegen-only is totally broken for AMDGPU. MC
gets a null target streamer. I do not understand why this
is a thing. This just creates a horrible edge case.
Just work around this by emitting actual code instead of blocking
this patch.
2022-10-28 21:42:57 -07:00
Matt Arsenault
c62745e167 DiagnosticInfo: Report function location for resource limits
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.
2022-10-28 21:42:57 -07:00
Arthur Eubanks
e42234383e Make DiagnosticInfoResourceLimit's limit param required
And always print it.

This makes some LLVM diagnostics match up better with Clang's diagnostics.

Updated some AMDGPU uses of DiagnosticInfoResourceLimit and now we print
better diagnostics for those.

Reviewed By: dblaikie

Differential Revision: https://reviews.llvm.org/D110204
2021-09-21 15:27:58 -07:00
Fangrui Song
f53d791520 Improve the diagnostic of DiagnosticInfoResourceLimit (and warn-stack-size in particular)
Before: `warning: stack size limit exceeded (888) in main`
After: `warning: stack frame size (888) exceeds limit (100) in function 'main'` (the -Wframe-larger-than limit will be mentioned)

Reviewed By: nickdesaulniers

Differential Revision: https://reviews.llvm.org/D104667
2021-06-22 09:55:20 -07:00
Konstantin Zhuravlyov
202c1b715f Revert "Mark test as unsupported until r315808 is fixed"
Test is fixed in r315830

llvm-svn: 315831
2017-10-14 22:24:31 +00:00
Bruno Cardoso Lopes
b37d05c9c1 Mark test as unsupported until r315808 is fixed
This is causing:
http://green.lab.llvm.org/green/job/clang-stage1-cmake-RA-incremental/43381

llvm-svn: 315829
2017-10-14 22:14:23 +00:00
Matt Arsenault
4deb4ed21e Update for DiagnosticInfoStackSize changes
llvm-svn: 273178
2016-06-20 18:13:09 +00:00