xref: /llvm-project/llvm/test/Transforms/SimpleLoopUnswitch/pr59546.ll (revision 98ffc7b1a88e6e9053333bff83b8ecef25f63b6c)
1; RUN: opt -passes="scc-oz-module-inliner,function(loop-mssa(no-op-loop)),recompute-globalsaa,function(loop-mssa(simple-loop-unswitch<nontrivial>))" -disable-output < %s
2; Check that don't crash if the Alias Analysis returns better results than
3; before when cloning loop's memoryssa.
4
5@a = internal global i16 0
6
7define void @h() {
8entry:
9  br label %end
10
11body:                                       ; No predecessors!
12  call void @g(ptr null)
13  br label %end
14
15end:                                        ; preds = %while.body, %entry
16  ret void
17}
18
19define internal void @g(ptr %a) #0 {
20entry:
21  br label %while.cond
22
23while.cond:                                       ; preds = %while.body, %entry
24  %0 = load i16, ptr %a, align 1
25  %tobool.not = icmp eq i16 %0, 0
26  br i1 %tobool.not, label %while.end, label %while.body
27
28while.body:                                       ; preds = %while.cond
29  call void @f()
30  br label %while.cond
31
32while.end:                                        ; preds = %while.cond
33  ret void
34}
35
36define internal void @f() #0 {
37  store i16 0, ptr @a, align 1
38  ret void
39}
40
41attributes #0 = { noinline }
42