1; RUN: opt %loadPolly -S -polly-codegen -polly-invariant-load-hoisting=true < %s
2;
3; Check that we generate valid code as we did non preload the base pointer
4; origin of %tmp4 at some point.
5;
6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7
8@TOP = external global i64*, align 8
9@BOT = external global i64*, align 8
10
11define void @RemoveConstraintVCG() {
12entry:
13  br i1 undef, label %for.end.161, label %for.cond.2.preheader
14
15for.cond.2.preheader:                             ; preds = %entry
16  br i1 undef, label %for.end.128, label %for.body.4
17
18for.body.4:                                       ; preds = %for.inc.126, %for.cond.2.preheader
19  br i1 undef, label %for.cond.8.preheader, label %for.inc.126
20
21for.cond.8.preheader:                             ; preds = %for.body.4
22  br i1 undef, label %for.inc.126, label %for.body.11
23
24for.body.11:                                      ; preds = %for.inc, %for.cond.8.preheader
25  br i1 undef, label %land.lhs.true, label %for.inc
26
27land.lhs.true:                                    ; preds = %for.body.11
28  br i1 undef, label %if.then.20, label %for.inc
29
30if.then.20:                                       ; preds = %land.lhs.true
31  %tmp = load i64*, i64** @TOP, align 8
32  %tmp1 = load i64, i64* %tmp, align 8
33  %cmp25 = icmp eq i64 %tmp1, 1
34  %cmp47 = icmp eq i64 %tmp1, 0
35  br i1 false, label %if.end.117, label %lor.lhs.false.85
36
37lor.lhs.false.85:                                 ; preds = %if.then.20
38  %add94 = add i64 %tmp1, 1
39  %tmp2 = load i64*, i64** @TOP, align 8
40  %arrayidx95 = getelementptr inbounds i64, i64* %tmp2, i64 %add94
41  %tmp3 = load i64, i64* %arrayidx95, align 8
42  br i1 false, label %if.else.103, label %land.lhs.true.97
43
44land.lhs.true.97:                                 ; preds = %lor.lhs.false.85
45  %tmp4 = load i64*, i64** @BOT, align 8
46  %arrayidx99 = getelementptr inbounds i64, i64* %tmp4, i64 %add94
47  %tmp5 = load i64, i64* %arrayidx99, align 8
48  %tobool100 = icmp eq i64 %tmp5, 0
49  br i1 %tobool100, label %if.else.103, label %if.then.101
50
51if.then.101:                                      ; preds = %land.lhs.true.97
52  br label %if.end.117
53
54if.else.103:                                      ; preds = %land.lhs.true.97, %lor.lhs.false.85
55  %tmp6 = load i64*, i64** @TOP, align 8
56  %arrayidx105 = getelementptr inbounds i64, i64* %tmp6, i64 %add94
57  %tmp7 = load i64, i64* %arrayidx105, align 8
58  br i1 false, label %lor.lhs.false.107, label %if.else.112
59
60lor.lhs.false.107:                                ; preds = %if.else.103
61  %tmp8 = load i64*, i64** @BOT, align 8
62  %arrayidx109 = getelementptr inbounds i64, i64* %tmp8, i64 %add94
63  br i1 false, label %if.end.117, label %if.else.112
64
65if.else.112:                                      ; preds = %lor.lhs.false.107, %if.else.103
66  br label %if.end.117
67
68if.end.117:                                       ; preds = %if.else.112, %lor.lhs.false.107, %if.then.101, %if.then.20
69  br i1 undef, label %if.then.119, label %for.inc
70
71if.then.119:                                      ; preds = %if.end.117
72  br label %for.inc
73
74for.inc:                                          ; preds = %if.then.119, %if.end.117, %land.lhs.true, %for.body.11
75  br i1 false, label %for.body.11, label %for.inc.126
76
77for.inc.126:                                      ; preds = %for.inc, %for.cond.8.preheader, %for.body.4
78  br i1 undef, label %for.end.128, label %for.body.4
79
80for.end.128:                                      ; preds = %for.inc.126, %for.cond.2.preheader
81  br i1 false, label %cond.false, label %cond.end
82
83cond.false:                                       ; preds = %for.end.128
84  unreachable
85
86cond.end:                                         ; preds = %for.end.128
87  unreachable
88
89for.end.161:                                      ; preds = %entry
90  ret void
91}
92