1; RUN: opt < %s -jump-threading -S -verify | FileCheck %s
2
3target datalayout = "e-m:w-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
4target triple = "x86_64-pc-windows-msvc19.16.27026"
5
6; Verify that we do *not* thread any edge.  On Windows, we used to
7; improperly duplicate EH pads like bb_cleanup below, resulting in an
8; assertion failure later down the pass pipeline.
9define void @foo([2 x i8]* %0) personality i8* bitcast (i32 ()* @baz to i8*) {
10; CHECK-LABEL: @foo
11; CHECK-NOT: bb_{{[^ ]*}}.thread:
12entry:
13  invoke void @bar()
14          to label %bb_invoke unwind label %bb_cleanuppad
15
16bb_invoke:
17  invoke void @bar()
18          to label %bb_exit unwind label %bb_cleanuppad
19
20bb_cleanuppad:
21  %index = phi i64 [ 1, %bb_invoke ], [ 0, %entry ]
22  %cond1 = phi i1 [ false, %bb_invoke ], [ true, %entry ]
23  %1 = cleanuppad within none []
24  br i1 %cond1, label %bb_action, label %bb_cleanupret
25
26bb_action:
27  %cond2 = icmp eq i64 %index, 0
28  br i1 %cond2, label %bb_cleanupret, label %bb_exit
29
30bb_exit:
31  call void @bar()
32  ret void
33
34bb_cleanupret:
35  cleanupret from %1 unwind to caller
36}
37
38declare void @bar()
39declare i32 @baz()
40