1 ; RUN: llc < %s | FileCheck %s
2 target triple = "armv6kz-unknown-unknown-gnueabihf"
4 ; Make sure this doesn't crash, and we actually emit a tail call.
5 ; Unfortunately, this test is sort of fragile... the original issue only
6 ; shows up if scheduling happens in a very specific order. But including
7 ; it anyway just to demonstrate the issue.
10 @e = external local_unnamed_addr constant [0 x i32 (i32, i32)*], align 4
12 ; Function Attrs: nounwind sspstrong
13 define i32 @AVI_ChunkRead_p_chk(i32 %g) nounwind sspstrong "target-cpu"="arm1176jzf-s" {
15 %b = alloca i8, align 1
16 %tobool = icmp eq i32 %g, 0
17 br i1 %tobool, label %if.end, label %if.then
19 if.then: ; preds = %entry
20 %add = add nsw i32 %g, 1
21 %arrayidx = getelementptr inbounds [0 x i32 (i32, i32)*], [0 x i32 (i32, i32)*]* @e, i32 0, i32 %add
22 %0 = load i32 (i32, i32)*, i32 (i32, i32)** %arrayidx, align 4
23 %call = tail call i32 %0(i32 0, i32 0) #3
26 if.end: ; preds = %entry
27 call void @c(i8* nonnull %b)
30 return: ; preds = %if.end, %if.then
31 %retval.0 = phi i32 [ %call, %if.then ], [ 0, %if.end ]