diff --git a/include/llvm/IR/DiagnosticInfo.h b/include/llvm/IR/DiagnosticInfo.h index 89c3f1ba976..9134ca12600 100644 --- a/include/llvm/IR/DiagnosticInfo.h +++ b/include/llvm/IR/DiagnosticInfo.h @@ -220,7 +220,7 @@ public: 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/lib/CodeGen/PrologEpilogInserter.cpp b/lib/CodeGen/PrologEpilogInserter.cpp index e745f561a89..2f65a450fb0 100644 --- a/lib/CodeGen/PrologEpilogInserter.cpp +++ b/lib/CodeGen/PrologEpilogInserter.cpp @@ -285,7 +285,7 @@ bool PEI::runOnMachineFunction(MachineFunction &MF) { (void)Failed; } if (StackSize > Threshold) { - DiagnosticInfoStackSize DiagStackSize(F, StackSize); + DiagnosticInfoStackSize DiagStackSize(F, StackSize, DS_Warning, Threshold); F.getContext().diagnose(DiagStackSize); } ORE->emit([&]() { diff --git a/lib/IR/DiagnosticInfo.cpp b/lib/IR/DiagnosticInfo.cpp index 59541704ef5..f9213827480 100644 --- a/lib/IR/DiagnosticInfo.cpp +++ b/lib/IR/DiagnosticInfo.cpp @@ -70,12 +70,10 @@ void DiagnosticInfoInlineAsm::print(DiagnosticPrinter &DP) const { } 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/test/CodeGen/AMDGPU/exceed-max-sgprs.ll b/test/CodeGen/AMDGPU/exceed-max-sgprs.ll index 13aafc24895..ad2c6debda7 100644 --- a/test/CodeGen/AMDGPU/exceed-max-sgprs.ll +++ b/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 @@ define amdgpu_kernel void @use_too_many_sgprs_tahiti() #0 { 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 @@ define amdgpu_kernel void @use_too_many_sgprs_bonaire() #1 { 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 @@ define amdgpu_kernel void @use_too_many_sgprs_bonaire_flat_scr() #1 { 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 @@ define amdgpu_kernel void @use_too_many_sgprs_iceland() #2 { 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/test/CodeGen/AMDGPU/stack-size-overflow.ll b/test/CodeGen/AMDGPU/stack-size-overflow.ll index 8550b7b1ed4..6977f0c4e47 100644 --- a/test/CodeGen/AMDGPU/stack-size-overflow.ll +++ b/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 @@ entry: 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/test/CodeGen/ARM/warn-stack.ll b/test/CodeGen/ARM/warn-stack.ll index 751590059d0..fbea89d8b81 100644 --- a/test/CodeGen/ARM/warn-stack.ll +++ b/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 @@ entry: 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" "warn-stack-size"="80" { entry: %buffer = alloca [80 x i8], align 1 diff --git a/test/CodeGen/X86/warn-stack.ll b/test/CodeGen/X86/warn-stack.ll index b0c51f22ebe..fc59c6edbee 100644 --- a/test/CodeGen/X86/warn-stack.ll +++ b/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 @@ entry: 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 "warn-stack-size"="80" { entry: %buffer = alloca [80 x i8], align 1