1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00
llvm-mirror/test/Feature/strip_names.ll
Mehdi Amini 96b6ab7056 Add a flag to the LLVMContext to disable name for Value other than GlobalValue
Summary:
This is intended to be a performance flag, on the same level as clang
cc1 option "--disable-free". LLVM will never initialize it by default,
it will be up to the client creating the LLVMContext to request this
behavior. Clang will do it by default in Release build (just like
--disable-free).

"opt" and "llc" can opt-in using -disable-named-value command line
option.

When performing LTO on llvm-tblgen, the initial merging of IR peaks
at 92MB without this patch, and 86MB after this patch,setNameImpl()
drops from 6.5MB to 0.5MB.
The total link time goes from ~29.5s to ~27.8s.

Compared to a compile-time flag (like the IRBuilder one), it performs
very close. I profiled on SROA and obtain these results:

 420ms with IRBuilder that preserve name
 372ms with IRBuilder that strip name
 375ms with IRBuilder that preserve name, and a runtime flag to strip

Reviewers: chandlerc, dexonsmith, bogner

Subscribers: joker.eph, llvm-commits

Differential Revision: http://reviews.llvm.org/D17946

From: Mehdi Amini <mehdi.amini@apple.com>
llvm-svn: 263086
2016-03-10 01:28:54 +00:00

27 lines
623 B
LLVM

; RUN: opt < %s -S | FileCheck %s
; RUN: opt < %s | opt -S -discard-value-names | FileCheck --check-prefix=NONAME %s
; CHECK: @GlobalValueName
; CHECK: @foo(i32 %in)
; CHECK: somelabel:
; CHECK: %GV = load i32, i32* @GlobalValueName
; CHECK: %add = add i32 %in, %GV
; CHECK: ret i32 %add
; NONAME: @GlobalValueName
; NONAME: @foo(i32)
; NONAME-NOT: somelabel:
; NONAME: %2 = load i32, i32* @GlobalValueName
; NONAME: %3 = add i32 %0, %2
; NONAME: ret i32 %3
@GlobalValueName = global i32 0
define i32 @foo(i32 %in) {
somelabel:
%GV = load i32, i32* @GlobalValueName
%add = add i32 %in, %GV
ret i32 %add
}