xref: /llvm-project/llvm/test/Transforms/SimplifyCFG/X86/bug-25299.ll (revision fbcefff9d0a3f5e97270ef8e7b8e0f2afc33dc1c)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --check-globals
2; RUN: opt < %s -passes=simplifycfg -simplifycfg-require-and-preserve-domtree=1 -S | FileCheck %s
3
4;; Test case for bug 25299, contributed by David Majnemer.
5
6target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
7target triple = "x86_64-unknown-linux-gnu"
8
9define void @f(i1 %B) personality i1 undef {
10; CHECK-LABEL: @f(
11; CHECK-NEXT:  entry:
12; CHECK-NEXT:    call void @g()
13; CHECK-NEXT:    br label [[CONTINUE:%.*]]
14; CHECK:       continue:
15; CHECK-NEXT:    call void @g()
16; CHECK-NEXT:    br label [[CONTINUE]]
17;
18entry:
19  invoke void @g()
20  to label %continue unwind label %unwind
21
22unwind:                                           ; preds = %entry
23  %tmp101 = landingpad { ptr, i32 }
24  cleanup
25  br i1 %B, label %resume, label %then
26
27then:                                             ; preds = %cleanup1
28  br label %resume
29
30resume:                                           ; preds = %cleanup2, %then, %cleanup1, %unwind
31  %tmp104 = phi { ptr, i32 } [ %tmp101, %then ], [ %tmp106, %cleanup2 ], [ %tmp101, %unwind ]
32  resume { ptr, i32 } %tmp104
33
34continue:                                         ; preds = %entry, %continue
35  invoke void @g()
36  to label %continue unwind label %cleanup2
37
38cleanup2:                                         ; preds = %continue
39  %tmp106 = landingpad { ptr, i32 }
40  cleanup
41  br label %resume
42}
43
44declare void @g()
45