1; RUN: opt -S -indvars < %s | FileCheck %s
2
3target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-apple-macosx10.11.0"
5
6@a = common global double* null, align 8
7@b = common global double 0.000000e+00, align 8
8
9define void @fn1(i32 %p1) {
10; CHECK-LABEL: @fn1(
11entry:
12  %ld = load double*, double** @a, align 8
13  br label %outer.loop
14
15outer.loop:
16  %iv.outer = phi i32 [ %p1, %entry ], [ %iv.outer.dec, %outer.be ]
17  %idxprom = sext i32 %iv.outer to i64
18  %arrayidx = getelementptr inbounds double, double* %ld, i64 %idxprom
19  %arrayidx.bc = bitcast double* %arrayidx to i64*
20  br label %inner.loop
21
22inner.loop:
23  %iv.inner = phi i32 [ %iv.outer, %outer.loop ], [ %iv.inner.dec, %inner.loop ]
24  %ld.arr = load i64, i64* %arrayidx.bc, align 8
25  store i64 %ld.arr, i64* bitcast (double* @b to i64*), align 8
26  %iv.inner.dec = add nsw i32 %iv.inner, -1
27  %cmp = icmp slt i32 %iv.outer, %iv.inner.dec
28  br i1 %cmp, label %outer.be, label %inner.loop
29
30outer.be:
31  %iv.outer.dec = add nsw i32 %iv.outer, -1
32  br label %outer.loop
33}
34