brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.6 KiB · 5436ee6 Raw
160 lines · plain
1; UNSUPPORTED: system-windows2;; Unsupported on Windows due to difficulty with escaping "opt" across platforms.3;; lit substitutes 'opt' with /path/to/opt.4 5; RUN: rm -rf %t && mkdir %t && cd %t6 7;; Copy IR from import-constant.ll since it generates all the temps8; RUN: opt -thinlto-bc %s -o 1.bc9; RUN: opt -thinlto-bc %p/Inputs/import-constant.ll -o 2.bc10 11;; Create the .all dir with save-temps saving everything, this will be used to compare12;; with the output from individualized save-temps later13; RUN: mkdir all all2 build subset subset214; RUN: llvm-lto2 run 1.bc 2.bc -o all/a.out \15; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \16; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \17; RUN:    -save-temps18 19;; The next 8 blocks follow this structure:20;; for each option of save-temps=21;;   Run lto and generate files22;;   Make sure a.out exists and is correct (by diff-ing)23;;     this is the only file that should recur between runs24;;   (Also, for some stages, copy the generated files to subset2 to check composability later)25;;   Move files that were expected to be generated to all226;;   Make sure there's no unexpected extra files27;; After that, we'll diff all and all2 to make sure all contents are identical28 29;; Check preopt30; RUN: llvm-lto2 run 1.bc 2.bc -o build/a.out \31; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \32; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \33; RUN:    -select-save-temps=preopt34; RUN: cmp all/a.out.1 build/a.out.1 && rm -f build/a.out.135; RUN: cmp all/a.out.2 build/a.out.2 && rm -f build/a.out.236; RUN: cp build/*.0.preopt.* subset237; RUN: mv build/*.0.preopt.* all238; RUN: ls build | count 039 40;; Check promote41; RUN: rm -f all2/*.1.promote*42; RUN: llvm-lto2 run 1.bc 2.bc -o build/a.out \43; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \44; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \45; RUN:    -select-save-temps=promote46; RUN: cmp all/a.out.1 build/a.out.1 && rm -f build/a.out.147; RUN: cmp all/a.out.2 build/a.out.2 && rm -f build/a.out.248; RUN: mv build/*.1.promote* all249; RUN: ls build | count 050 51;; Check internalize52; RUN: llvm-lto2 run 1.bc 2.bc -o build/a.out \53; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \54; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \55; RUN:    -select-save-temps=internalize56; RUN: cmp all/a.out.1 build/a.out.1 && rm -f build/a.out.157; RUN: cmp all/a.out.2 build/a.out.2 && rm -f build/a.out.258; RUN: mv build/*.2.internalize* all259; RUN: ls build | count 060 61;; Check import62; RUN: llvm-lto2 run 1.bc 2.bc -o build/a.out \63; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \64; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \65; RUN:    -select-save-temps=import66; RUN: cmp all/a.out.1 build/a.out.1 && rm -f build/a.out.167; RUN: cmp all/a.out.2 build/a.out.2 && rm -f build/a.out.268; RUN: mv build/*.3.import* all269; RUN: ls build | count 070 71;; Check opt72; RUN: llvm-lto2 run 1.bc 2.bc -o build/a.out \73; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \74; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \75; RUN:    -select-save-temps=\opt76; RUN: cmp all/a.out.1 build/a.out.1 && rm -f build/a.out.177; RUN: cmp all/a.out.2 build/a.out.2 && rm -f build/a.out.278; RUN: cp build/*.4.opt* subset279; RUN: mv build/*.4.opt* all280; RUN: ls build | count 081 82;; Check precodegen83; RUN: llvm-lto2 run 1.bc 2.bc -o build/a.out \84; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \85; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \86; RUN:    -select-save-temps=precodegen87; RUN: cmp all/a.out.1 build/a.out.1 && rm -f build/a.out.188; RUN: cmp all/a.out.2 build/a.out.2 && rm -f build/a.out.289; RUN: mv build/*.5.precodegen* all290; RUN: ls build | count 091 92;; Check combinedindex93; RUN: llvm-lto2 run 1.bc 2.bc -o build/a.out \94; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \95; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \96; RUN:    -select-save-temps=combinedindex97; RUN: cmp all/a.out.1 build/a.out.1 && rm -f build/a.out.198; RUN: cmp all/a.out.2 build/a.out.2 && rm -f build/a.out.299; RUN: cp build/*.index.bc subset2100; RUN: cp build/*.index.dot subset2101; RUN: mv build/*.index.bc all2102; RUN: mv build/*.index.dot all2103; RUN: ls build | count 0104 105;; Check resolution106; RUN: llvm-lto2 run 1.bc 2.bc -o build/a.out \107; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \108; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \109; RUN:    -select-save-temps=resolution110;; all2 needs at least 1 copy of a.out, move it over now since its the last block111; RUN: mv build/a.out.1 build/a.out.2 all2112; RUN: mv build/*.resolution.txt all2113; RUN: ls build | count 0114 115;; If no files were left out from individual stages, the .all2 dir should be identical to .all116; RUN: diff -r all all2117 118;; Check multi-stage composability119;; Similar to the above, but do it with a subset instead.120;; .all -> .subset, .all2 -> .subset2121; RUN: llvm-lto2 run 1.bc 2.bc -o subset/a.out \122; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \123; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \124; RUN:    -select-save-temps=preopt,combinedindex,\opt125; RUN: cmp all/a.out.1 subset/a.out.1 && rm -f subset/a.out.1126; RUN: cmp all/a.out.2 subset/a.out.2 && rm -f subset/a.out.2127; RUN: diff -r subset subset2128 129;; Check error messages130; RUN: not llvm-lto2 run 1.bc 2.bc -o build/a.out \131; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \132; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \133; RUN:    -select-save-temps=prelink 2>&1 \134; RUN: | FileCheck %s --check-prefix=ERR1135; ERR1: invalid -select-save-temps argument: prelink136 137; RUN: not llvm-lto2 run 1.bc 2.bc -o build/a.out \138; RUN:    -import-constants-with-refs -r=1.bc,main,plx -r=1.bc,_Z6getObjv,l \139; RUN:    -r=2.bc,_Z6getObjv,pl -r=2.bc,val,pl -r=2.bc,outer,pl \140; RUN:    -select-save-temps=preopt -save-temps 2>&1 \141; RUN: | FileCheck %s --check-prefix=ERR2142; ERR2: -save-temps cannot be specified with -select-save-temps143 144target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"145target triple = "x86_64-unknown-linux-gnu"146 147%struct.S = type { i32, i32, ptr }148 149define dso_local i32 @main() local_unnamed_addr {150entry:151  %call = tail call ptr @_Z6getObjv()152  %0 = load i32, ptr %call, align 8153  %v = getelementptr inbounds %struct.S, ptr %call, i64 0, i32 1154  %1 = load i32, ptr %v, align 4155  %add = add nsw i32 %1, %0156  ret i32 %add157}158 159declare dso_local ptr @_Z6getObjv() local_unnamed_addr160