1; RUN: opt -passes=simple-loop-unswitch,loop-deletion -verify-memoryssa -S < %s | FileCheck %s 2; 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. 6 7target triple = "x86_64-unknown-linux-gnu" 8 9define void @pr37888() { 10; CHECK-LABEL: define void @pr37888() 11entry: 12 %tobool = icmp ne i16 undef, 0 13 br label %for.body 14; CHECK: %[[TOBOOL:.*]] = icmp ne 15; CHECK-NEXT: br i1 %[[TOBOOL]], label %if.then, label %[[ENTRY_SPLIT:.*]] 16; 17; CHECK: [[ENTRY_SPLIT]]: 18; CHECK-NEXT: br label %for.end 19 20for.body: 21 br i1 %tobool, label %if.then, label %if.end 22 23if.then: 24 unreachable 25; CHECK: if.then: 26; CHECK-NEXT: unreachable 27 28if.end: 29 br label %for.inc 30 31for.inc: 32 br i1 false, label %for.body, label %for.end 33 34for.end: 35 ret void 36; CHECK: for.end: 37; CHECK-NEXT: ret void 38} 39