diff --git a/clang/test/Misc/backend-resource-limit-diagnostics.cl b/clang/test/Misc/backend-resource-limit-diagnostics.cl --- a/clang/test/Misc/backend-resource-limit-diagnostics.cl +++ b/clang/test/Misc/backend-resource-limit-diagnostics.cl @@ -1,7 +1,7 @@ // REQUIRES: amdgpu-registered-target // RUN: not %clang_cc1 -emit-codegen-only -triple=amdgcn-- %s 2>&1 | FileCheck %s -// CHECK: error: local memory limit exceeded (480000) in use_huge_lds +// CHECK: error: local memory (480000) exceeds limit in function 'use_huge_lds' kernel void use_huge_lds() { volatile local int huge[120000]; diff --git a/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp b/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp --- a/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp +++ b/clang/test/Misc/backend-stack-frame-diagnostics-fallback.cpp @@ -13,7 +13,7 @@ }; // CHECK: warning: stack frame size of {{[0-9]+}} bytes in function 'frameSizeThunkWarning::B::f' - // CHECK: warning: stack size limit exceeded ({{[0-9]+}}) in {{[^ ]+}} + // CHECK: warning: stack frame size ([[#]]) exceeds limit in function '_ZTv0_n12_N21frameSizeThunkWarning1B1fEv' void B::f() { volatile int x = 0; // Ensure there is stack usage. } diff --git a/llvm/include/llvm/IR/DiagnosticInfo.h b/llvm/include/llvm/IR/DiagnosticInfo.h --- a/llvm/include/llvm/IR/DiagnosticInfo.h +++ b/llvm/include/llvm/IR/DiagnosticInfo.h @@ -220,7 +220,7 @@ DiagnosticInfoStackSize(const Function &Fn, uint64_t StackSize, DiagnosticSeverity Severity = DS_Warning, uint64_t StackLimit = 0) - : DiagnosticInfoResourceLimit(Fn, "stack size", StackSize, Severity, + : DiagnosticInfoResourceLimit(Fn, "stack frame size", StackSize, Severity, DK_StackSize, StackLimit) {} uint64_t getStackSize() const { return getResourceSize(); } diff --git a/llvm/lib/CodeGen/PrologEpilogInserter.cpp b/llvm/lib/CodeGen/PrologEpilogInserter.cpp --- a/llvm/lib/CodeGen/PrologEpilogInserter.cpp +++ b/llvm/lib/CodeGen/PrologEpilogInserter.cpp @@ -276,7 +276,7 @@ unsigned Threshold = MF.getFunction().getParent()->getWarnStackSize(); if (StackSize > Threshold) { - DiagnosticInfoStackSize DiagStackSize(F, StackSize); + DiagnosticInfoStackSize DiagStackSize(F, StackSize, DS_Warning, Threshold); F.getContext().diagnose(DiagStackSize); } ORE->emit([&]() { diff --git a/llvm/lib/IR/DiagnosticInfo.cpp b/llvm/lib/IR/DiagnosticInfo.cpp --- a/llvm/lib/IR/DiagnosticInfo.cpp +++ b/llvm/lib/IR/DiagnosticInfo.cpp @@ -70,12 +70,10 @@ } void DiagnosticInfoResourceLimit::print(DiagnosticPrinter &DP) const { - DP << getResourceName() << " limit"; - + DP << getResourceName() << " (" << getResourceSize() << ") exceeds limit"; if (getResourceLimit() != 0) - DP << " of " << getResourceLimit(); - - DP << " exceeded (" << getResourceSize() << ") in " << getFunction(); + DP << " (" << getResourceLimit() << ')'; + DP << " in function '" << getFunction() << '\''; } void DiagnosticInfoDebugMetadataVersion::print(DiagnosticPrinter &DP) const { diff --git a/llvm/test/CodeGen/AMDGPU/exceed-max-sgprs.ll b/llvm/test/CodeGen/AMDGPU/exceed-max-sgprs.ll --- a/llvm/test/CodeGen/AMDGPU/exceed-max-sgprs.ll +++ b/llvm/test/CodeGen/AMDGPU/exceed-max-sgprs.ll @@ -1,6 +1,6 @@ ; RUN: not llc -march=amdgcn -verify-machineinstrs < %s 2>&1 | FileCheck -check-prefix=ERROR %s -; ERROR: error: scalar registers limit of 104 exceeded (106) in use_too_many_sgprs_tahiti +; ERROR: error: scalar registers (106) exceeds limit (104) in function 'use_too_many_sgprs_tahiti' define amdgpu_kernel void @use_too_many_sgprs_tahiti() #0 { call void asm sideeffect "", "~{s[0:7]}" () call void asm sideeffect "", "~{s[8:15]}" () @@ -19,7 +19,7 @@ ret void } -; ERROR: error: scalar registers limit of 104 exceeded (106) in use_too_many_sgprs_bonaire +; ERROR: error: scalar registers (106) exceeds limit (104) in function 'use_too_many_sgprs_bonaire' define amdgpu_kernel void @use_too_many_sgprs_bonaire() #1 { call void asm sideeffect "", "~{s[0:7]}" () call void asm sideeffect "", "~{s[8:15]}" () @@ -38,7 +38,7 @@ ret void } -; ERROR: error: scalar registers limit of 104 exceeded (108) in use_too_many_sgprs_bonaire_flat_scr +; ERROR: error: scalar registers (108) exceeds limit (104) in function 'use_too_many_sgprs_bonaire_flat_scr' define amdgpu_kernel void @use_too_many_sgprs_bonaire_flat_scr() #1 { call void asm sideeffect "", "~{s[0:7]}" () call void asm sideeffect "", "~{s[8:15]}" () @@ -58,7 +58,7 @@ ret void } -; ERROR: error: scalar registers limit of 96 exceeded (98) in use_too_many_sgprs_iceland +; ERROR: error: scalar registers (98) exceeds limit (96) in function 'use_too_many_sgprs_iceland' define amdgpu_kernel void @use_too_many_sgprs_iceland() #2 { call void asm sideeffect "", "~{vcc}" () call void asm sideeffect "", "~{s[0:7]}" () @@ -76,7 +76,7 @@ ret void } -; ERROR: error: addressable scalar registers limit of 102 exceeded (103) in use_too_many_sgprs_fiji +; ERROR: error: addressable scalar registers (103) exceeds limit (102) in function 'use_too_many_sgprs_fiji' define amdgpu_kernel void @use_too_many_sgprs_fiji() #3 { call void asm sideeffect "", "~{s[0:7]}" () call void asm sideeffect "", "~{s[8:15]}" () diff --git a/llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll b/llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll --- a/llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll +++ b/llvm/test/CodeGen/AMDGPU/stack-size-overflow.ll @@ -3,7 +3,7 @@ declare void @llvm.memset.p5i8.i32(i8 addrspace(5)* nocapture, i8, i32, i32, i1) #1 -; ERROR: error: stack size limit exceeded (131061) in stack_size_limit_wave64 +; ERROR: error: stack frame size (131061) exceeds limit in function 'stack_size_limit_wave64' ; GCN: ; ScratchSize: 131061 define amdgpu_kernel void @stack_size_limit_wave64() #0 { entry: @@ -13,7 +13,7 @@ ret void } -; ERROR: error: stack size limit exceeded (262117) in stack_size_limit_wave32 +; ERROR: error: stack frame size (262117) exceeds limit in function 'stack_size_limit_wave32' ; GCN: ; ScratchSize: 262117 define amdgpu_kernel void @stack_size_limit_wave32() #1 { entry: diff --git a/llvm/test/CodeGen/ARM/warn-stack.ll b/llvm/test/CodeGen/ARM/warn-stack.ll --- a/llvm/test/CodeGen/ARM/warn-stack.ll +++ b/llvm/test/CodeGen/ARM/warn-stack.ll @@ -1,5 +1,5 @@ ; RUN: llc -mtriple thumbv7-apple-ios3.0.0 < %s 2>&1 >/dev/null | FileCheck %s -; Check the internal option that warns when the stack size exceeds the +; Check the internal option that warns when the stack frame size exceeds the ; given amount. ; @@ -12,7 +12,7 @@ ret void } -; CHECK: warning: stack size limit exceeded (92) in warn +; CHECK: warning: stack frame size (92) exceeds limit (80) in function 'warn' define void @warn() nounwind ssp "frame-pointer"="all" { entry: %buffer = alloca [80 x i8], align 1 diff --git a/llvm/test/CodeGen/X86/warn-stack.ll b/llvm/test/CodeGen/X86/warn-stack.ll --- a/llvm/test/CodeGen/X86/warn-stack.ll +++ b/llvm/test/CodeGen/X86/warn-stack.ll @@ -1,5 +1,5 @@ ; RUN: llc -mtriple x86_64-apple-macosx10.8.0 < %s 2>&1 >/dev/null | FileCheck %s -; Check the internal option that warns when the stack size exceeds the +; Check the internal option that warns when the stack frame size exceeds the ; given amount. ; @@ -12,7 +12,7 @@ ret void } -; CHECK: warning: stack size limit exceeded (88) in warn +; CHECK: warning: stack frame size (88) exceeds limit (80) in function 'warn' define void @warn() nounwind ssp { entry: %buffer = alloca [80 x i8], align 1