1 ; RUN: opt < %s -S -basicaa -licm | FileCheck %s
4 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
5 target triple = "x86_64-pc-windows-msvc"
7 @in = internal unnamed_addr global i32* null, align 8
8 @out = internal unnamed_addr global i32* null, align 8
12 ; CHECK: load i64* bitcast (i32** @in to i64*)
16 define i64 @bar(i32 %N) {
20 do.body: ; preds = %l2, %entry
21 %i.0 = phi i32 [ 0, %entry ], [ %inc, %l2 ]
22 %total = phi i64 [ 0, %entry ], [ %next, %l2 ]
23 %c = icmp eq i32 %N, 6
24 br i1 %c, label %l1, label %do.body.l2_crit_edge
26 do.body.l2_crit_edge: ; preds = %do.body
27 %inval.pre = load i32** @in, align 8
30 l1: ; preds = %do.body
31 %v1 = load i64* bitcast (i32** @in to i64*), align 8
32 store i64 %v1, i64* bitcast (i32** @out to i64*), align 8
33 %0 = inttoptr i64 %v1 to i32*
36 l2: ; preds = %do.body.l2_crit_edge, %l1
37 %inval = phi i32* [ %inval.pre, %do.body.l2_crit_edge ], [ %0, %l1 ]
38 %int = ptrtoint i32* %inval to i64
39 %next = add i64 %total, %int
40 %inc = add nsw i32 %i.0, 1
41 %cmp = icmp slt i32 %inc, %N
42 br i1 %cmp, label %do.body, label %do.end