brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 05368e9 Raw
75 lines · plain
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --include-generated-funcs --version 52; RUN: opt -passes="ipsccp<func-spec>" -funcspec-min-function-size=1       \3; RUN:                                 -funcspec-for-literal-constant=true \4; RUN:                                 -funcspec-min-codesize-savings=50   \5; RUN:                                 -funcspec-min-latency-savings=0     \6; RUN:                                 -S < %s | FileCheck %s7 8; Verify that we are able to estimate the codesize savings arising from a block9; which is found dead, where the block has a predecessor that was found dead by10; IPSCCP.11define i32 @main(i1 %flag) {12  %notspec = call i32 @test(i1 %flag, i1 true)13  %spec = call i32 @test(i1 true, i1 true)14  %sum = add i32 %notspec, %spec15  ret i32 %sum16}17 18define internal i32 @test(i1 %argflag, i1 %constflag) {19entry:20  br i1 %argflag, label %block1, label %block321 22block1:23  br i1 %constflag, label %end, label %block224 25block2:26  br label %block327 28block3:29  call void @do_something()30  call void @do_something()31  call void @do_something()32  call void @do_something()33  br label %end34 35end:36  %res = phi i32 [ 0, %block1 ], [ 1, %block3]37  ret i32 %res38}39 40declare void @do_something()41; CHECK-LABEL: define range(i32 0, 2) i32 @main(42; CHECK-SAME: i1 [[FLAG:%.*]]) {43; CHECK-NEXT:    [[NOTSPEC:%.*]] = call i32 @test(i1 [[FLAG]], i1 true)44; CHECK-NEXT:    [[SPEC:%.*]] = call i32 @test.specialized.1(i1 true, i1 true)45; CHECK-NEXT:    [[SUM:%.*]] = add nuw nsw i32 [[NOTSPEC]], 046; CHECK-NEXT:    ret i32 [[SUM]]47;48;49; CHECK-LABEL: define internal range(i32 0, 2) i32 @test(50; CHECK-SAME: i1 [[ARGFLAG:%.*]], i1 [[CONSTFLAG:%.*]]) {51; CHECK-NEXT:  [[ENTRY:.*:]]52; CHECK-NEXT:    br i1 [[ARGFLAG]], label %[[BLOCK1:.*]], label %[[BLOCK3:.*]]53; CHECK:       [[BLOCK1]]:54; CHECK-NEXT:    br label %[[END:.*]]55; CHECK:       [[BLOCK3]]:56; CHECK-NEXT:    call void @do_something()57; CHECK-NEXT:    call void @do_something()58; CHECK-NEXT:    call void @do_something()59; CHECK-NEXT:    call void @do_something()60; CHECK-NEXT:    br label %[[END]]61; CHECK:       [[END]]:62; CHECK-NEXT:    [[RES:%.*]] = phi i32 [ 0, %[[BLOCK1]] ], [ 1, %[[BLOCK3]] ]63; CHECK-NEXT:    ret i32 [[RES]]64;65;66; CHECK-LABEL: define internal i32 @test.specialized.1(67; CHECK-SAME: i1 [[ARGFLAG:%.*]], i1 [[CONSTFLAG:%.*]]) {68; CHECK-NEXT:  [[ENTRY:.*:]]69; CHECK-NEXT:    br label %[[BLOCK1:.*]]70; CHECK:       [[BLOCK1]]:71; CHECK-NEXT:    br label %[[END:.*]]72; CHECK:       [[END]]:73; CHECK-NEXT:    ret i32 poison74;75