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
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.
8 target triple = "x86_64-unknown-linux-gnu"
10 define void @pr37888() {
11 ; CHECK-LABEL: define void @pr37888()
13 %tobool = icmp ne i16 undef, 0
15 ; CHECK: %[[TOBOOL:.*]] = icmp ne
16 ; CHECK-NEXT: br i1 %[[TOBOOL]], label %if.then, label %[[ENTRY_SPLIT:.*]]
18 ; CHECK: [[ENTRY_SPLIT]]:
19 ; CHECK-NEXT: br label %for.end
22 br i1 %tobool, label %if.then, label %if.end
27 ; CHECK-NEXT: unreachable
33 br i1 undef, label %for.body, label %for.end
38 ; CHECK-NEXT: ret void