xref: /llvm-project/llvm/test/ThinLTO/X86/index-const-prop-ldst.ll (revision 41d5033eb162cb92b684855166cabfa3983b74c6)
1bf46e741SEugene Leviant; RUN: opt -module-summary %s -o %t1.bc
2bf46e741SEugene Leviant; RUN: opt -module-summary %p/Inputs/index-const-prop-define-g.ll -o %t2.bc
3bf46e741SEugene Leviant; RUN: llvm-lto2 run -save-temps %t2.bc -r=%t2.bc,g,pl %t1.bc -r=%t1.bc,main,plx -r=%t1.bc,g, -o %t3
4bf46e741SEugene Leviant; RUN: llvm-dis %t3.2.3.import.bc -o - | FileCheck %s
5bf46e741SEugene Leviant
6bf46e741SEugene Leviant; The 'store' instruction in @main should prevent internalization
7bf46e741SEugene Leviant; even when there is 'load' instruction before it.
8d2ef8c1fSFangrui Song; CHECK: @g = available_externally global i32 42
9bf46e741SEugene Leviant
107b1d7937SAmy Huangtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
11bf46e741SEugene Levianttarget triple = "x86_64-unknown-linux-gnu"
12bf46e741SEugene Leviant
13bf46e741SEugene Leviant@g = external global i32
14bf46e741SEugene Leviant
15bf46e741SEugene Leviantdefine i32 @main() {
16*41d5033eSNikita Popov  %v = load i32, ptr @g
17bf46e741SEugene Leviant  %q = add i32 %v, 1
18*41d5033eSNikita Popov  store i32 %q, ptr @g
19bf46e741SEugene Leviant
20bf46e741SEugene Leviant  ret i32 %v
21bf46e741SEugene Leviant}
22