diff options
| author | Sergei Larin <slarin@codeaurora.org> | 2016-01-18 21:07:13 +0000 |
|---|---|---|
| committer | Sergei Larin <slarin@codeaurora.org> | 2016-01-18 21:07:13 +0000 |
| commit | d19d4d30d84cf6befcda72ff957bf31a7e4e7335 (patch) | |
| tree | 5434bd7eaa5acf192f0038c6d8cf81fa48276fef /llvm/test/tools/llvm-split/preserve-locals.ll | |
| parent | df9e61b599d475b65870163fa10459f480f90093 (diff) | |
| download | bcm5719-llvm-d19d4d30d84cf6befcda72ff957bf31a7e4e7335.tar.gz bcm5719-llvm-d19d4d30d84cf6befcda72ff957bf31a7e4e7335.zip | |
Add to the split module utility an SCC based method which allows not to globalize any local variables.
Summary:
Currently llvm::SplitModule as the first step globalizes all local objects, which might not be desirable in some scenarios.
This change adds a new flag to llvm::SplitModule that uses SCC approach to search for a balanced partition without the need to externalize symbols.
Such partition might not be possible or fully balanced for a given number of partitions, and is a function of the module properties (global/local dependencies within the module).
Joint development Tobias Edler von Koch (tobias@codeaurora.org) and Sergei Larin (slarin@codeaurora.org)
Subscribers: llvm-commits, joker.eph
Differential Revision: http://reviews.llvm.org/D16124
llvm-svn: 258083
Diffstat (limited to 'llvm/test/tools/llvm-split/preserve-locals.ll')
| -rw-r--r-- | llvm/test/tools/llvm-split/preserve-locals.ll | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/llvm/test/tools/llvm-split/preserve-locals.ll b/llvm/test/tools/llvm-split/preserve-locals.ll new file mode 100644 index 00000000000..7556c25bba3 --- /dev/null +++ b/llvm/test/tools/llvm-split/preserve-locals.ll @@ -0,0 +1,65 @@ +; RUN: llvm-split -preserve-locals -o %t %s +; RUN: llvm-dis -o - %t0 | FileCheck --check-prefix=CHECK0 %s +; RUN: llvm-dis -o - %t1 | FileCheck --check-prefix=CHECK1 %s + +; The local_var and local_func must not be separated. +; CHECK0: @local_var +; CHECK0: define internal fastcc void @local_func +; The main and a must not be separated. +; The main and local_func must not be together. +; CHECK1: @a +; CHECK1: define i32 @main +; CHECK1: declare fastcc void @local_func + +@a = internal global i32 0, align 4 +@global_storage = common global i32 0, align 4 +@local_var = internal global i32 0, align 4 + +; Function Attrs: nounwind +define i32 @main(i32 %x) { +entry: + %call = call fastcc i32 @foo(i32 %x, i32* nonnull @a) + %call1 = call fastcc i32 @baz(i32 %x) + %add = add nsw i32 %call, %call1 + ret i32 %add +} + +; Function Attrs: nounwind +define fastcc i32 @bar(i32 %b) { +entry: + %call = call fastcc i32 @baz(i32 %b) + ret i32 %call +} + +; Function Attrs: nounwind +define fastcc i32 @baz(i32 %x) { +entry: + store i32 %x, i32* @global_storage, align 4 + %shl = shl i32 %x, %x + ret i32 %shl +} + +; Function Attrs: noinline nounwind +define fastcc i32 @foo(i32 %a, i32* nocapture %b) { +entry: + call fastcc void @local_func() + %call = call fastcc i32 @bar(i32 %a) + %0 = load i32, i32* @global_storage, align 4 + %call1 = call fastcc i32 @baz(i32 %0) + %add = add nsw i32 %call, %call1 + store i32 %add, i32* %b, align 4 + %call.i = call fastcc i32 @baz(i32 %add) #2 + %add.i = add nsw i32 %call.i, 2 + %1 = load volatile i32, i32* @local_var, align 4 + %add3 = add nsw i32 %add.i, %1 + ret i32 %add3 +} + +; Function Attrs: noinline nounwind +define internal fastcc void @local_func() section ".text" { +entry: + %0 = load i32, i32* @global_storage, align 4 + %call = call fastcc i32 @foo(i32 %0, i32* null) + store volatile i32 %call, i32* @local_var, align 4 + ret void +} |

