1; RUN: llc -march=hexagon < %s
2; REQUIRES: asserts
3
4target datalayout = "e-m:e-p:32:32:32-a:0-n16:32-i64:64:64-i32:32:32-i16:16:16-i1:8:8-f32:32:32-f64:64:64-v32:32:32-v64:64:64-v512:512:512-v1024:1024:1024-v2048:2048:2048"
5target triple = "hexagon"
6
7define weak_odr hidden i32 @fred(i32* %this, i32* nocapture readonly dereferenceable(4) %__k) #0 align 2 {
8entry:
9  %call = tail call i64 @danny(i32* %this, i32* nonnull dereferenceable(4) %__k) #2
10  %__p.sroa.0.0.extract.trunc = trunc i64 %call to i32
11  br i1 undef, label %for.end, label %for.body
12
13for.body:                                         ; preds = %for.body, %entry
14  %__p.sroa.0.018 = phi i32 [ %call8, %for.body ], [ %__p.sroa.0.0.extract.trunc, %entry ]
15  %call8 = tail call i32 @sammy(i32* %this, i32 %__p.sroa.0.018) #2
16  %0 = inttoptr i32 %call8 to i32*
17  %lnot.i = icmp eq i32* %0, undef
18  br i1 %lnot.i, label %for.end, label %for.body
19
20for.end:                                          ; preds = %for.body, %entry
21  ret i32 0
22}
23
24declare hidden i64 @danny(i32*, i32* nocapture readonly dereferenceable(4)) #1 align 2
25declare hidden i32 @sammy(i32* nocapture, i32) #0 align 2
26
27attributes #0 = { nounwind optsize "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length64b" "unsafe-fp-math"="false" "use-soft-float"="false" }
28attributes #1 = { nounwind optsize readonly "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="hexagonv60" "target-features"="+hvx,+hvx-length64b" "unsafe-fp-math"="false" "use-soft-float"="false" }
29attributes #2 = { optsize }
30
31