128 lines · plain
1; RUN: opt < %s -passes=inline,argpromotion,instcombine -disable-output2 3; This test was failing because the inliner would inline @list_DeleteElement4; into @list_DeleteDuplicates and then into @inf_GetBackwardPartnerLits,5; turning the indirect call into a direct one. This allowed instcombine to see6; the bitcast and eliminate it, deleting the original call and introducing7; another one. This crashed the inliner because the new call was not in the8; callgraph.9 10target datalayout = "e-p:32:32:32-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:64:64-v128:128:128-a0:0:64-f80:128:128"11target triple = "i386-apple-darwin10.0"12 13 14define void @list_DeleteElement(ptr nocapture %Test) nounwind ssp {15entry:16 %0 = call i32 %Test(ptr null, ptr undef) nounwind17 ret void18}19 20 21define void @list_DeleteDuplicates(ptr nocapture %Test) nounwind ssp {22foo:23 call void @list_DeleteElement(ptr %Test) nounwind ssp 24 call fastcc void @list_Rplacd1284() nounwind ssp25 unreachable26 27}28 29define internal i32 @inf_LiteralsHaveSameSubtermAndAreFromSameClause(ptr nocapture %L1, ptr nocapture %L2) nounwind readonly ssp {30entry:31 unreachable32}33 34 35define internal fastcc void @inf_GetBackwardPartnerLits(ptr nocapture %Flags) nounwind ssp {36test:37 call void @list_DeleteDuplicates(ptr @inf_LiteralsHaveSameSubtermAndAreFromSameClause) nounwind 38 ret void39}40 41 42define void @inf_BackwardEmptySortPlusPlus() nounwind ssp {43entry:44 call fastcc void @inf_GetBackwardPartnerLits(ptr null) nounwind ssp45 unreachable46}47 48define void @inf_BackwardWeakening() nounwind ssp {49entry:50 call fastcc void @inf_GetBackwardPartnerLits(ptr null) nounwind ssp51 unreachable52}53 54declare fastcc void @list_Rplacd1284() nounwind ssp55 56 57 58 59;============================60; PR520861 62define void @AAA() personality ptr @__gxx_personality_v0 {63entry:64 %A = alloca i8, i32 undef, align 165 invoke fastcc void @XXX()66 to label %invcont98 unwind label %lpad156 67 68invcont98: 69 unreachable70 71lpad156: 72 %exn = landingpad {ptr, i32}73 cleanup74 unreachable75}76 77declare i32 @__gxx_personality_v0(...)78 79declare fastcc void @YYY()80 81define internal fastcc void @XXX() personality ptr @__gxx_personality_v0 {82entry:83 %B = alloca i8, i32 undef, align 184 invoke fastcc void @YYY()85 to label %bb260 unwind label %lpad86 87bb260: 88 ret void89 90lpad: 91 %exn = landingpad {ptr, i32}92 cleanup93 resume { ptr, i32 } %exn94}95 96 97 98;; This exposed a crash handling devirtualized calls.99define void @f1(ptr %f) ssp {100entry:101 call void %f()102 ret void103}104 105define void @f4(i32 %size) ssp personality ptr @__gxx_personality_v0 {106entry:107 invoke void @f1(ptr @f3)108 to label %invcont3 unwind label %lpad18109 110invcont3: ; preds = %bb1111 ret void112 113lpad18: ; preds = %invcont3, %bb1114 %exn = landingpad {ptr, i32}115 cleanup116 unreachable117}118 119define void @f3() ssp {120entry:121 unreachable122}123 124declare void @f5() ssp125 126 127 128