xref: /llvm-project/llvm/test/Analysis/MemorySSA/pr42294.ll (revision 7f172e82be0fcb4f0ae66f7bb3662d88b479d994)
1; REQUIRES: asserts
2; RUN: opt -passes='loop-mssa(loop-rotate,licm)' %s -disable-output -debug-only=licm 2>&1 | FileCheck %s -check-prefix=LICM
3; RUN: opt -passes='loop-mssa(loop-rotate,licm)' %s -S  | FileCheck %s
4
5; LICM-NOT: LICM sinking instruction:   %.pre = load i8, ptr %arrayidx.phi.trans.insert
6
7; CHECK-LABEL: @fn1
8; CHECK-LABEL: entry:
9; CHECK:    br i1 true, label %[[END:.*]], label %[[PH:.*]]
10; CHECK: [[PH]]:
11; CHECK:    br label %[[CRIT:.*]]
12; CHECK: [[CRIT]]:
13; CHECK:    load i8
14; CHECK:    store i8
15; CHECK:    br i1 true, label %[[ENDCRIT:.*]], label %[[CRIT]]
16; CHECK: [[ENDCRIT]]:
17; CHECK-NOT: load i8
18; CHECK:    br label %[[END]]
19
20target datalayout = "E-m:e-i1:8:16-i8:8:16-i64:64-f128:64-a:8:16-n32:64"
21target triple = "s390x-unknown-linux-gnu"
22
23define void @fn1() {
24entry:
25  %g = alloca [9 x i8], align 1
26  br label %for.body
27
28for.body:                                         ; preds = %for.body.for.body_crit_edge, %entry
29  %0 = phi i64 [ 0, %entry ], [ %phitmp, %for.body.for.body_crit_edge ]
30  %indvars.iv = phi i64 [ 0, %entry ], [ %indvars.iv.next, %for.body.for.body_crit_edge ]
31  %arrayidx = getelementptr inbounds [9 x i8], ptr %g, i64 0, i64 %indvars.iv
32  store i8 2, ptr %arrayidx, align 1
33  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
34  br i1 undef, label %for.end18, label %for.body.for.body_crit_edge
35
36for.body.for.body_crit_edge:                      ; preds = %for.body
37  %arrayidx.phi.trans.insert = getelementptr inbounds [9 x i8], ptr %g, i64 0, i64 %indvars.iv.next
38  %.pre = load i8, ptr %arrayidx.phi.trans.insert, align 1
39  %phitmp = zext i8 %.pre to i64
40  br label %for.body
41
42for.end18:                                        ; preds = %for.body
43  store i64 %0, ptr undef, align 8
44  ret void
45}
46
47