1; REQUIRES: arm-registered-target
2; RUN: opt -S -loop-unroll -codegenprepare < %s -domtree -analyze | FileCheck %s
3;
4; Checks that the dom tree is properly invalidated after an operation that will
5; invalidate it in CodeGenPrepare. If the domtree isn't properly invalidated,
6; this will likely segfault, or print badref.
7
8; CHECK-NOT: <badref>
9
10target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n32-S64"
11target triple = "armv7--linux-gnueabihf"
12
13define i32 @f(i32 %a) #0 {
14entry:
15  br label %for.body
16
17for.cond.cleanup:
18  ret i32 %or
19
20for.body:
21  %i.08 = phi i32 [ 0, %entry ], [ %inc, %for.body ]
22  %b.07 = phi i32 [ 0, %entry ], [ %or, %for.body ]
23  %shr = lshr i32 %a, %i.08
24  %and = and i32 %shr, 1
25  %sub = sub nuw nsw i32 31, %i.08
26  %shl = shl i32 %and, %sub
27  %or = or i32 %shl, %b.07
28  %inc = add nuw nsw i32 %i.08, 1
29  %exitcond = icmp eq i32 %inc, 32
30  br i1 %exitcond, label %for.cond.cleanup, label %for.body, !llvm.loop !3
31}
32
33attributes #0 = { norecurse nounwind readnone "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"="cortex-a8" "target-features"="+dsp,+neon,+vfp3" "unsafe-fp-math"="false" "use-soft-float"="false" }
34
35!llvm.module.flags = !{!0, !1}
36!llvm.ident = !{!2}
37
38!0 = !{i32 1, !"wchar_size", i32 4}
39!1 = !{i32 1, !"min_enum_size", i32 4}
40!2 = !{!"clang version 3.8.0"}
41!3 = distinct !{!3, !4}
42!4 = !{!"llvm.loop.unroll.full"}
43