brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · e1cacce Raw
74 lines · plain
1; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=3 -S < %s | FileCheck %s2; RUN: opt -passes="ipsccp<no-func-spec>" -funcspec-min-function-size=3 -S < %s | FileCheck %s --check-prefix=NOFSPEC3 4define i64 @main(i64 %x, i1 %flag) {5;6; CHECK-LABEL: @main(i64 %x, i1 %flag) {7; CHECK:      entry:8; CHECK-NEXT:   br i1 %flag, label %plus, label %minus9; CHECK:      plus:10; CHECK-NEXT:   [[TMP0:%.+]] = call i64 @compute.specialized.1(i64 %x, ptr @plus)11; CHECK-NEXT:   br label %merge12; CHECK:      minus:13; CHECK-NEXT:   [[TMP1:%.+]] = call i64 @compute.specialized.2(i64 %x, ptr @minus)14; CHECK-NEXT:   br label %merge15; CHECK:      merge:16; CHECK-NEXT:   [[TMP2:%.+]] = phi i64 [ [[TMP0]], %plus ], [ [[TMP1]], %minus ]17; CHECK-NEXT:   ret i64 [[TMP2]]18; CHECK-NEXT: }19;20; NOFSPEC-LABEL: @main(i64 %x, i1 %flag) {21; NOFSPEC-NOT: call i64 @compute.specialized.{{[0-9]+}}(22; NOFSPEC: call i64 @compute(23;24entry:25  br i1 %flag, label %plus, label %minus26 27plus:28  %tmp0 = call i64 @compute(i64 %x, ptr @plus)29  br label %merge30 31minus:32  %tmp1 = call i64 @compute(i64 %x, ptr @minus)33  br label %merge34 35merge:36  %tmp2 = phi i64 [ %tmp0, %plus ], [ %tmp1, %minus]37  ret i64 %tmp238}39 40; CHECK-NOT: define internal i64 @compute(41;42; CHECK-LABEL: define internal i64 @compute.specialized.1(i64 %x, ptr %binop) {43; CHECK-NEXT:  entry:44; CHECK-NEXT:    [[TMP0:%.+]] = call i64 @plus(i64 %x)45; CHECK-NEXT:    ret i64 [[TMP0]]46; CHECK-NEXT:  }47;48; CHECK-LABEL: define internal i64 @compute.specialized.2(i64 %x, ptr %binop) {49; CHECK-NEXT:  entry:50; CHECK-NEXT:    [[TMP0:%.+]] = call i64 @minus(i64 %x)51; CHECK-NEXT:    ret i64 [[TMP0]]52; CHECK-NEXT:  }53;54; NOFSPEC: define internal i64 @compute(55; NOFSPEC-NOT: define internal i64 @compute.specialized.{{[0-9]+}}(56;57define internal i64 @compute(i64 %x, ptr %binop) {58entry:59  %tmp0 = call i64 %binop(i64 %x)60  ret i64 %tmp061}62 63define internal i64 @plus(i64 %x) {64entry:65  %tmp0 = add i64 %x, 166  ret i64 %tmp067}68 69define internal i64 @minus(i64 %x) {70entry:71  %tmp0 = sub i64 %x, 172  ret i64 %tmp073}74