1 ; RUN: llc %s -o - -O0 -verify-machineinstrs -fast-isel=true | FileCheck %s
3 target datalayout = "e-m:o-i64:64-i128:128-n32:64-S128"
4 target triple = "arm64-apple-ios8.0.0"
6 ; This test was trying to fold the sext %tmp142 in to the address arithmetic in %sunkaddr1.
7 ; This was incorrect as %.mux isn't available in the last bb.
9 ; CHECK: sxtw [[REG0:x[0-9]+]]
10 ; CHECK: str [[REG0]], [sp, [[OFFSET:#[0-9]+]]]
11 ; CHECK: ldr [[REG1:x[0-9]+]], [sp, [[OFFSET]]]
12 ; CHECK: strh wzr, [{{.*}}, [[REG1]], lsl #1]
14 ; Function Attrs: nounwind optsize ssp
15 define void @EdgeLoop(i32 %dir, i32 %edge, i32 %width, i16* %tmp89, i32 %tmp136, i16 %tmp144) #0 {
17 %tmp2 = icmp eq i32 %dir, 0
18 %.mux = select i1 %tmp2, i32 %width, i32 1
19 %tmp142 = sext i32 %.mux to i64
20 %tmp151 = shl nsw i64 %tmp142, 1
21 %tmp153 = getelementptr inbounds i16, i16* %tmp89, i64 %tmp151
22 %tmp154 = load i16, i16* %tmp153, align 2
23 %tmp155 = zext i16 %tmp154 to i32
24 br i1 %tmp2, label %bb225, label %bb212
27 store i16 %tmp144, i16* %tmp89, align 2
31 %tmp248 = trunc i32 %tmp155 to i16
32 store i16 %tmp248, i16* %tmp89, align 2
33 %sunkaddr = ptrtoint i16* %tmp89 to i64
34 %sunkaddr1 = mul i64 %tmp142, 2
35 %sunkaddr2 = add i64 %sunkaddr, %sunkaddr1
36 %sunkaddr3 = inttoptr i64 %sunkaddr2 to i16*
37 store i16 0, i16* %sunkaddr3, align 2
41 attributes #0 = { nounwind optsize ssp }