1 ; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
5 ; Eliminates store to %R in the entry block.
6 ; RUN: opt < %s -passes=dse -debug-counter=dse-memoryssa-skip=0,dse-memoryssa-count=1 -S | FileCheck --check-prefix=SKIP0-COUNT1 %s
8 ; Eliminates store to %P in the entry block.
9 ; RUN: opt < %s -passes=dse -debug-counter=dse-memoryssa-skip=1,dse-memoryssa-count=1 -S | FileCheck --check-prefix=SKIP1-COUNT1 %s
11 ; Eliminates both stores in the entry block.
12 ; RUN: opt < %s -passes=dse -debug-counter=dse-memoryssa-skip=0,dse-memoryssa-count=2 -S | FileCheck --check-prefix=SKIP0-COUNT2 %s
14 ; Eliminates no stores.
15 ; RUN: opt < %s -passes=dse -debug-counter=dse-memoryssa-skip=2,dse-memoryssa-count=1 -S | FileCheck --check-prefix=SKIP2-COUNT1 %s
18 target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
21 define void @test(ptr noalias %P, ptr noalias %Q, ptr noalias %R) {
22 ; SKIP0-COUNT1-LABEL: @test(
23 ; SKIP0-COUNT1-NEXT: store i32 1, ptr [[P:%.*]]
24 ; SKIP0-COUNT1-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
26 ; SKIP0-COUNT1-NEXT: br label [[BB3:%.*]]
28 ; SKIP0-COUNT1-NEXT: br label [[BB3]]
30 ; SKIP0-COUNT1-NEXT: store i32 0, ptr [[Q:%.*]]
31 ; SKIP0-COUNT1-NEXT: store i32 0, ptr [[R:%.*]]
32 ; SKIP0-COUNT1-NEXT: store i32 0, ptr [[P]]
33 ; SKIP0-COUNT1-NEXT: ret void
35 ; SKIP1-COUNT1-LABEL: @test(
36 ; SKIP1-COUNT1-NEXT: store i32 1, ptr [[R:%.*]]
37 ; SKIP1-COUNT1-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
39 ; SKIP1-COUNT1-NEXT: br label [[BB3:%.*]]
41 ; SKIP1-COUNT1-NEXT: br label [[BB3]]
43 ; SKIP1-COUNT1-NEXT: store i32 0, ptr [[Q:%.*]]
44 ; SKIP1-COUNT1-NEXT: store i32 0, ptr [[R]]
45 ; SKIP1-COUNT1-NEXT: store i32 0, ptr [[P:%.*]]
46 ; SKIP1-COUNT1-NEXT: ret void
48 ; SKIP0-COUNT2-LABEL: @test(
49 ; SKIP0-COUNT2-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
51 ; SKIP0-COUNT2-NEXT: br label [[BB3:%.*]]
53 ; SKIP0-COUNT2-NEXT: br label [[BB3]]
55 ; SKIP0-COUNT2-NEXT: store i32 0, ptr [[Q:%.*]]
56 ; SKIP0-COUNT2-NEXT: store i32 0, ptr [[R:%.*]]
57 ; SKIP0-COUNT2-NEXT: store i32 0, ptr [[P:%.*]]
58 ; SKIP0-COUNT2-NEXT: ret void
60 ; SKIP2-COUNT1-LABEL: @test(
61 ; SKIP2-COUNT1-NEXT: store i32 1, ptr [[P:%.*]]
62 ; SKIP2-COUNT1-NEXT: store i32 1, ptr [[R:%.*]]
63 ; SKIP2-COUNT1-NEXT: br i1 true, label [[BB1:%.*]], label [[BB2:%.*]]
65 ; SKIP2-COUNT1-NEXT: br label [[BB3:%.*]]
67 ; SKIP2-COUNT1-NEXT: br label [[BB3]]
69 ; SKIP2-COUNT1-NEXT: store i32 0, ptr [[Q:%.*]]
70 ; SKIP2-COUNT1-NEXT: store i32 0, ptr [[R]]
71 ; SKIP2-COUNT1-NEXT: store i32 0, ptr [[P]]
72 ; SKIP2-COUNT1-NEXT: ret void
76 br i1 true, label %bb1, label %bb2