diff options
| author | Eugene Leviant <eleviant@accesssoftek.com> | 2018-11-16 07:08:00 +0000 |
|---|---|---|
| committer | Eugene Leviant <eleviant@accesssoftek.com> | 2018-11-16 07:08:00 +0000 |
| commit | bf46e7410c8a1d26c4a434261baaae28a904d657 (patch) | |
| tree | a8037e2560e4fd3aee808885ae87901c8e857afa /llvm/test/ThinLTO/X86/index-const-prop-gvref.ll | |
| parent | 079c37da5870239d0332870e6c8cea877b335600 (diff) | |
| download | bcm5719-llvm-bf46e7410c8a1d26c4a434261baaae28a904d657.tar.gz bcm5719-llvm-bf46e7410c8a1d26c4a434261baaae28a904d657.zip | |
[ThinLTO] Internalize readonly globals
An attempt to recommit r346584 after failure on OSX build bot.
Fixed cache key computation in ThinLTOCodeGenerator and added
test case
llvm-svn: 347033
Diffstat (limited to 'llvm/test/ThinLTO/X86/index-const-prop-gvref.ll')
| -rw-r--r-- | llvm/test/ThinLTO/X86/index-const-prop-gvref.ll | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll b/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll new file mode 100644 index 00000000000..87103fee141 --- /dev/null +++ b/llvm/test/ThinLTO/X86/index-const-prop-gvref.ll @@ -0,0 +1,27 @@ +; RUN: opt -module-summary %s -o %t1.bc +; RUN: opt -module-summary %p/Inputs/index-const-prop-gvref.ll -o %t2.bc +; RUN: llvm-lto2 run -save-temps %t2.bc -r=%t2.bc,b,pl -r=%t2.bc,a,pl \ +; RUN: %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,a, -r=%t1.bc,b, -o %t3 +; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=SRC +; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s --check-prefix=DEST + +; No variable in the source module should have been internalized +; SRC: @b = dso_local global i32* @a +; SRC-NEXT: @a = dso_local global i32 42 + +; We can't internalize globals referenced by other live globals +; DEST: @b = external dso_local global i32* +; DEST-NEXT: @a = available_externally dso_local global i32 42, align 4 + +target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" +target triple = "x86_64-unknown-linux-gnu" + +@a = external global i32 +@b = external global i32* + +define i32 @main() { + %p = load i32*, i32** @b, align 8 + store i32 33, i32* %p, align 4 + %v = load i32, i32* @a, align 4 + ret i32 %v +} |

