brintos

brintos / llvm-project-archived public Read only

0
0
Text · 6.6 KiB · 8f8078d Raw
161 lines · plain
1; This file verifies the behavior of the OptBisect class, which is used to2; diagnose optimization related failures.  The tests check various3; invocations that result in different sets of optimization passes that4; are run in different ways.5;6; Because the exact set of optimizations that will be run is expected to7; change over time, the checks for disabling passes are written in a8; conservative way that avoids assumptions about which specific passes9; will be disabled.10 11; RUN: opt -disable-output -disable-verify \12; RUN:     -passes=inferattrs -opt-bisect-limit=-1 %s 2>&1 \13; RUN:     | FileCheck %s --check-prefix=CHECK-MODULE-PASS14; CHECK-MODULE-PASS: BISECT: running pass (1) inferattrs on [module]15 16; RUN: opt -disable-output -disable-verify \17; RUN:     -passes=inferattrs -opt-bisect-limit=0 %s 2>&1 \18; RUN:     | FileCheck %s --check-prefix=CHECK-LIMIT-MODULE-PASS19; CHECK-LIMIT-MODULE-PASS: BISECT: NOT running pass (1) inferattrs on [module]20 21; RUN: opt -disable-output -debug-pass-manager \22; RUN:     -passes=inferattrs -opt-bisect-limit=-1 %s 2>&1 \23; RUN:     | FileCheck %s --check-prefix=CHECK-REQUIRED-PASS24; CHECK-REQUIRED-PASS: BISECT: running pass (1) inferattrs on [module]25; CHECK-REQUIRED-PASS-NOT: BISECT: {{.*}}VerifierPass26; CHECK-REQUIRED-PASS: Running pass: VerifierPass27 28; RUN: opt -disable-output -debug-pass-manager \29; RUN:     -passes=inferattrs -opt-bisect-limit=0 %s 2>&1 \30; RUN:     | FileCheck %s --check-prefix=CHECK-LIMIT-REQUIRED-PASS31; CHECK-LIMIT-REQUIRED-PASS: BISECT: NOT running pass (1) inferattrs on [module]32; CHECK-LIMIT-REQUIRED-PASS-NOT: BISECT: {{.*}}VerifierPass33; CHECK-LIMIT-REQUIRED-PASS: Running pass: VerifierPass34 35; RUN: opt -disable-output -disable-verify \36; RUN:     -passes=early-cse -opt-bisect-limit=-1 %s 2>&1 \37; RUN:     | FileCheck %s --check-prefix=CHECK-FUNCTION-PASS38; CHECK-FUNCTION-PASS: BISECT: running pass (1) early-cse on f139; CHECK-FUNCTION-PASS: BISECT: running pass (2) early-cse on f240; CHECK-FUNCTION-PASS: BISECT: running pass (3) early-cse on f341; CHECK-FUNCTION-PASS: BISECT: running pass (4) early-cse on f442 43; RUN: opt -disable-output -disable-verify \44; RUN:     -passes=early-cse -opt-bisect-limit=2 %s 2>&1 \45; RUN:     | FileCheck %s --check-prefix=CHECK-LIMIT-FUNCTION-PASS46; CHECK-LIMIT-FUNCTION-PASS: BISECT: running pass (1) early-cse on f147; CHECK-LIMIT-FUNCTION-PASS: BISECT: running pass (2) early-cse on f248; CHECK-LIMIT-FUNCTION-PASS: BISECT: NOT running pass (3) early-cse on f349; CHECK-LIMIT-FUNCTION-PASS: BISECT: NOT running pass (4) early-cse on f450 51; RUN: opt -disable-output -disable-verify \52; RUN:     -passes=function-attrs -opt-bisect-limit=-1 %s 2>&1 \53; RUN:     | FileCheck %s --check-prefix=CHECK-CGSCC-PASS54; CHECK-CGSCC-PASS: BISECT: running pass (1) function-attrs on (f1)55; CHECK-CGSCC-PASS: BISECT: running pass (2) function-attrs on (f2)56; CHECK-CGSCC-PASS: BISECT: running pass (3) function-attrs on (f3)57; CHECK-CGSCC-PASS: BISECT: running pass (4) function-attrs on (f4)58 59; RUN: opt -disable-output -disable-verify \60; RUN:     -passes=function-attrs -opt-bisect-limit=3 %s 2>&1 \61; RUN:     | FileCheck %s --check-prefix=CHECK-LIMIT-CGSCC-PASS62; CHECK-LIMIT-CGSCC-PASS: BISECT: running pass (1) function-attrs on (f1)63; CHECK-LIMIT-CGSCC-PASS: BISECT: running pass (2) function-attrs on (f2)64; CHECK-LIMIT-CGSCC-PASS: BISECT: running pass (3) function-attrs on (f3)65; CHECK-LIMIT-CGSCC-PASS: BISECT: NOT running pass (4) function-attrs on (f4)66 67; RUN: opt -disable-output -disable-verify -opt-bisect-limit=-1 \68; RUN:     -passes='inferattrs,cgscc(function-attrs,function(early-cse))' %s 2>&1 \69; RUN:     | FileCheck %s --check-prefix=CHECK-MULTI-PASS70; CHECK-MULTI-PASS: BISECT: running pass (1) inferattrs on [module]71; CHECK-MULTI-PASS: BISECT: running pass (2) function-attrs on (f1)72; CHECK-MULTI-PASS: BISECT: running pass (3) early-cse on f173; CHECK-MULTI-PASS: BISECT: running pass (4) function-attrs on (f2)74; CHECK-MULTI-PASS: BISECT: running pass (5) early-cse on f275; CHECK-MULTI-PASS: BISECT: running pass (6) function-attrs on (f3)76; CHECK-MULTI-PASS: BISECT: running pass (7) early-cse on f377; CHECK-MULTI-PASS: BISECT: running pass (8) function-attrs on (f4)78; CHECK-MULTI-PASS: BISECT: running pass (9) early-cse on f479 80; RUN: opt -disable-output -disable-verify -opt-bisect-limit=7 \81; RUN:     -passes='inferattrs,cgscc(function-attrs,function(early-cse))' %s 2>&1 \82; RUN:     | FileCheck %s --check-prefix=CHECK-LIMIT-MULTI-PASS83; CHECK-LIMIT-MULTI-PASS: BISECT: running pass (1) inferattrs on [module]84; CHECK-LIMIT-MULTI-PASS: BISECT: running pass (2) function-attrs on (f1)85; CHECK-LIMIT-MULTI-PASS: BISECT: running pass (3) early-cse on f186; CHECK-LIMIT-MULTI-PASS: BISECT: running pass (4) function-attrs on (f2)87; CHECK-LIMIT-MULTI-PASS: BISECT: running pass (5) early-cse on f288; CHECK-LIMIT-MULTI-PASS: BISECT: running pass (6) function-attrs on (f3)89; CHECK-LIMIT-MULTI-PASS: BISECT: running pass (7) early-cse on f390; CHECK-LIMIT-MULTI-PASS: BISECT: NOT running pass (8) function-attrs on (f4)91; CHECK-LIMIT-MULTI-PASS: BISECT: NOT running pass (9) early-cse on f492 93; Make sure we don't skip writing the output to stdout.94; RUN: opt %s -opt-bisect-limit=0 -passes=early-cse | opt -S | FileCheck %s -check-prefix=CHECK-OUTPUT95; RUN: opt %s -opt-bisect-limit=0 -passes=early-cse -S | FileCheck %s -check-prefix=CHECK-OUTPUT96; CHECK-OUTPUT: define void @f197 98; Make sure we write ThinLTO bitcode99; RUN: opt %s -opt-bisect-limit=0 -disable-verify -thinlto-bc -o /dev/null 2>&1 | FileCheck --allow-empty %s -check-prefix=CHECK-THINLTO100; CHECK-THINLTO-NOT: NOT running pass101 102declare i32 @g()103 104define void @f1(i1 %arg) {105entry:106  br label %loop.0107loop.0:108  br i1 %arg, label %loop.0.0, label %loop.1109loop.0.0:110  br i1 %arg, label %loop.0.0, label %loop.0.1111loop.0.1:112  br i1 %arg, label %loop.0.1, label %loop.0113loop.1:114  br i1 %arg, label %loop.1, label %loop.1.bb1115loop.1.bb1:116  br i1 %arg, label %loop.1, label %loop.1.bb2117loop.1.bb2:118  br i1 %arg, label %end, label %loop.1.0119loop.1.0:120  br i1 %arg, label %loop.1.0, label %loop.1121end:122  ret void123}124 125define i32 @f2() {126entry:127  ret i32 0128}129 130define i32 @f3() {131entry:132  %temp = call i32 @g()133  %icmp = icmp ugt i32 %temp, 2134  br i1 %icmp, label %bb.true, label %bb.false135bb.true:136  %temp2 = call i32 @f2()137  ret i32 %temp2138bb.false:139  ret i32 0140}141 142; This function is here to verify that opt-bisect can skip all passes for143; functions that contain lifetime intrinsics.144define void @f4(i1 %arg) {145entry:146  %i = alloca i32, align 4147  call void @llvm.lifetime.start(i64 4, ptr %i)148  br label %for.cond149 150for.cond:151  br i1 %arg, label %for.body, label %for.end152 153for.body:154  br label %for.cond155 156for.end:157  ret void158}159 160declare void @llvm.lifetime.start(i64, ptr nocapture)161