1 ; RUN: opt < %s -S -basic-aa -licm | FileCheck %s
2 ; RUN: opt -aa-pipeline=basic-aa -passes='require<opt-remark-emit>,loop-mssa(licm)' < %s -S | FileCheck %s
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-pc-windows-msvc"
8 @in = internal unnamed_addr global i32* null, align 8
9 @out = internal unnamed_addr global i32* null, align 8
13 ; CHECK: load i64, i64* bitcast (i32** @in to i64*)
17 define i64 @bar(i32 %N) {
21 do.body: ; preds = %l2, %entry
22 %i.0 = phi i32 [ 0, %entry ], [ %inc, %l2 ]
23 %total = phi i64 [ 0, %entry ], [ %next, %l2 ]
24 %c = icmp eq i32 %N, 6
25 br i1 %c, label %l1, label %do.body.l2_crit_edge
27 do.body.l2_crit_edge: ; preds = %do.body
28 %inval.pre = load i32*, i32** @in, align 8
31 l1: ; preds = %do.body
32 %v1 = load i64, i64* bitcast (i32** @in to i64*), align 8
33 store i64 %v1, i64* bitcast (i32** @out to i64*), align 8
34 %0 = inttoptr i64 %v1 to i32*
37 l2: ; preds = %do.body.l2_crit_edge, %l1
38 %inval = phi i32* [ %inval.pre, %do.body.l2_crit_edge ], [ %0, %l1 ]
39 %int = ptrtoint i32* %inval to i64
40 %next = add i64 %total, %int
41 %inc = add nsw i32 %i.0, 1
42 %cmp = icmp slt i32 %inc, %N
43 br i1 %cmp, label %do.body, label %do.end