[ValueTracking] De-pessimize isImpliedCondition around unsigned compares
[oota-llvm.git] / test / Transforms / GVN / 2011-09-07-TypeIdFor.ll
1 ; RUN: opt < %s -basicaa -gvn -S | FileCheck %s
2 %struct.__fundamental_type_info_pseudo = type { %struct.__type_info_pseudo }
3 %struct.__type_info_pseudo = type { i8*, i8* }
4
5 @_ZTIi = external constant %struct.__fundamental_type_info_pseudo
6 @_ZTIb = external constant %struct.__fundamental_type_info_pseudo
7
8 declare void @_Z4barv()
9
10 declare void @_Z7cleanupv()
11
12 declare i32 @llvm.eh.typeid.for(i8*) nounwind readonly
13
14 declare i8* @__cxa_begin_catch(i8*) nounwind
15
16 declare void @__cxa_end_catch()
17
18 declare i32 @__gxx_personality_v0(i32, i64, i8*, i8*)
19
20 define void @_Z3foov() uwtable personality i32 (i32, i64, i8*, i8*)* @__gxx_personality_v0 {
21 entry:
22   invoke void @_Z4barv()
23           to label %return unwind label %lpad
24
25 lpad:                                             ; preds = %entry
26   %0 = landingpad { i8*, i32 }
27           catch %struct.__fundamental_type_info_pseudo* @_ZTIi
28           catch %struct.__fundamental_type_info_pseudo* @_ZTIb
29           catch %struct.__fundamental_type_info_pseudo* @_ZTIi
30           catch %struct.__fundamental_type_info_pseudo* @_ZTIb
31   %exc_ptr2.i = extractvalue { i8*, i32 } %0, 0
32   %filter3.i = extractvalue { i8*, i32 } %0, 1
33   %typeid.i = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*))
34 ; CHECK: call i32 @llvm.eh.typeid.for
35   %1 = icmp eq i32 %filter3.i, %typeid.i
36   br i1 %1, label %ppad, label %next
37
38 next:                                             ; preds = %lpad
39   %typeid1.i = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIb to i8*))
40 ; CHECK: call i32 @llvm.eh.typeid.for
41   %2 = icmp eq i32 %filter3.i, %typeid1.i
42   br i1 %2, label %ppad2, label %next2
43
44 ppad:                                             ; preds = %lpad
45   %3 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr2.i) nounwind
46   tail call void @__cxa_end_catch() nounwind
47   br label %return
48
49 ppad2:                                            ; preds = %next
50   %D.2073_5.i = tail call i8* @__cxa_begin_catch(i8* %exc_ptr2.i) nounwind
51   tail call void @__cxa_end_catch() nounwind
52   br label %return
53
54 next2:                                            ; preds = %next
55   call void @_Z7cleanupv()
56   %typeid = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIi to i8*))
57 ; CHECK-NOT: call i32 @llvm.eh.typeid.for
58   %4 = icmp eq i32 %filter3.i, %typeid
59   br i1 %4, label %ppad3, label %next3
60
61 next3:                                            ; preds = %next2
62   %typeid1 = tail call i32 @llvm.eh.typeid.for(i8* bitcast (%struct.__fundamental_type_info_pseudo* @_ZTIb to i8*))
63   %5 = icmp eq i32 %filter3.i, %typeid1
64   br i1 %5, label %ppad4, label %unwind
65
66 unwind:                                           ; preds = %next3
67   resume { i8*, i32 } %0
68
69 ppad3:                                            ; preds = %next2
70   %6 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr2.i) nounwind
71   tail call void @__cxa_end_catch() nounwind
72   br label %return
73
74 ppad4:                                            ; preds = %next3
75   %D.2080_5 = tail call i8* @__cxa_begin_catch(i8* %exc_ptr2.i) nounwind
76   tail call void @__cxa_end_catch() nounwind
77   br label %return
78
79 return:                                           ; preds = %ppad4, %ppad3, %ppad2, %ppad, %entry
80   ret void
81 }