1 ; RUN: opt -passes=simple-loop-unswitch,loop-deletion -verify-memoryssa -S < %s | FileCheck %s
3 ; Check that when we do unswitching where we re-enqueue the loop to be processed
4 ; again, but manage to delete the loop before ever getting to iterate on it, it
5 ; doesn't crash the legacy pass manager.
7 target triple = "x86_64-unknown-linux-gnu"
9 define void @pr37888() {
10 ; CHECK-LABEL: define void @pr37888()
12 %tobool = icmp ne i16 undef, 0
14 ; CHECK: %[[TOBOOL:.*]] = icmp ne
15 ; CHECK-NEXT: br i1 %[[TOBOOL]], label %if.then, label %[[ENTRY_SPLIT:.*]]
17 ; CHECK: [[ENTRY_SPLIT]]:
18 ; CHECK-NEXT: br label %for.end
21 br i1 %tobool, label %if.then, label %if.end
26 ; CHECK-NEXT: unreachable
32 br i1 false, label %for.body, label %for.end
37 ; CHECK-NEXT: ret void