• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; RUN: opt -simple-loop-unswitch -loop-deletion -S < %s | FileCheck %s
2; RUN: opt -simple-loop-unswitch -enable-mssa-loop-dependency=true -verify-memoryssa -loop-deletion -S < %s | FileCheck %s
3;
4; Check that when we do unswitching where we re-enqueue the loop to be processed
5; again, but manage to delete the loop before ever getting to iterate on it, it
6; doesn't crash the legacy pass manager.
7
8target triple = "x86_64-unknown-linux-gnu"
9
10define void @pr37888() {
11; CHECK-LABEL: define void @pr37888()
12entry:
13  %tobool = icmp ne i16 undef, 0
14  br label %for.body
15; CHECK:         %[[TOBOOL:.*]] = icmp ne
16; CHECK-NEXT:    br i1 %[[TOBOOL]], label %if.then, label %[[ENTRY_SPLIT:.*]]
17;
18; CHECK:       [[ENTRY_SPLIT]]:
19; CHECK-NEXT:    br label %for.end
20
21for.body:
22  br i1 %tobool, label %if.then, label %if.end
23
24if.then:
25  unreachable
26; CHECK:       if.then:
27; CHECK-NEXT:    unreachable
28
29if.end:
30  br label %for.inc
31
32for.inc:
33  br i1 undef, label %for.body, label %for.end
34
35for.end:
36  ret void
37; CHECK:       for.end:
38; CHECK-NEXT:    ret void
39}
40