brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · f31f9b3 Raw
51 lines · plain
1; Check that we optimize out writeonly variables and corresponding stores.2; This test uses llvm-lto23 4; RUN: opt -module-summary %s -o %t1.bc5; RUN: opt -module-summary %p/Inputs/index-const-prop.ll -o %t2.bc6; RUN: llvm-lto2 run %t1.bc %t2.bc -save-temps \7; RUN:  -r=%t2.bc,foo,pl \8; RUN:  -r=%t2.bc,bar,pl \9; RUN:  -r=%t2.bc,baz,pl \10; RUN:  -r=%t2.bc,rand, \11; RUN:  -r=%t2.bc,gBar,pl \12; RUN:  -r=%t1.bc,main,plx \13; RUN:  -r=%t1.bc,baz, \14; RUN:  -r=%t1.bc,gBar, \15; RUN:  -o %t316; RUN: llvm-dis %t3.1.3.import.bc -o - | FileCheck %s --check-prefix=IMPORT17; RUN: llvm-dis %t3.1.5.precodegen.bc -o - | FileCheck %s --check-prefix=CODEGEN18; Check that gFoo and gBar were eliminated from source module together19; with corresponsing stores20; RUN: llvm-dis %t3.2.5.precodegen.bc -o - | FileCheck %s --check-prefix=CODEGEN-SRC21 22; IMPORT:       @gBar = internal local_unnamed_addr global i32 0, align 423; IMPORT-NEXT:  @gFoo.llvm.0 = internal unnamed_addr global i32 0, align 424; IMPORT:       !DICompileUnit({{.*}})25 26; CODEGEN-NOT:  gFoo27; CODEGEN-NOT:  gBar28; CODEGEN:      i32 @main29; CODEGEN-NEXT:   %1 = tail call i32 @rand()30; CODEGEN-NEXT:   %2 = tail call i32 @rand()31; CODEGEN-NEXT:   ret i32 032 33; CODEGEN-SRC-NOT:   gFoo34; CODEGEN-SRC-NOT:   gBar35; CODEGEN-SRC:       void @baz()36; CODEGEN-SRC-NEXT:    %1 = tail call i32 @rand()37; CODEGEN-SRC-NEXT:    %2 = tail call i32 @rand()38; CODEGEN-SRC-NEXT:    ret void39 40target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"41target triple = "x86_64-pc-linux-gnu"42 43; We should be able to link external definition of gBar to its declaration44@gBar = external global i3245 46define i32 @main() local_unnamed_addr {47  tail call void @baz()48  ret i32 049}50declare void @baz() local_unnamed_addr51