1; RUN: opt %s -mergefunc -globalopt -S -o - | FileCheck %s 2 3; Make sure we don't crash on this example. This test is supposed to test that 4; MergeFunctions clears its GlobalNumbers value map. If this map still contains 5; entries when running globalopt and the MergeFunctions instance is still alive 6; the optimization of @G would cause an assert because globalopt would do an 7; RAUW on @G which still exists as an entry in the GlobalNumbers ValueMap which 8; causes an assert in the ValueHandle call back because we are RAUWing with a 9; different type (AllocaInst) than its key type (GlobalValue). 10 11@G = internal global i8** null 12@G2 = internal global i8** null 13 14define i32 @main(i32 %argc, i8** %argv) norecurse { 15; CHECK: alloca 16 store i8** %argv, i8*** @G 17 ret i32 0 18} 19 20define internal i8** @dead1(i64 %p) { 21 call void @right(i64 %p) 22 call void @right(i64 %p) 23 call void @right(i64 %p) 24 call void @right(i64 %p) 25 %tmp = load i8**, i8*** @G 26 ret i8** %tmp 27} 28 29define internal i8** @dead2(i64 %p) { 30 call void @right(i64 %p) 31 call void @right(i64 %p) 32 call void @right(i64 %p) 33 call void @right(i64 %p) 34 %tmp = load i8**, i8*** @G2 35 ret i8** %tmp 36} 37 38define void @left(i64 %p) { 39entry-block: 40 call void @right(i64 %p) 41 call void @right(i64 %p) 42 call void @right(i64 %p) 43 call void @right(i64 %p) 44 ret void 45} 46 47define void @right(i64 %p) { 48entry-block: 49 call void @left(i64 %p) 50 call void @left(i64 %p) 51 call void @left(i64 %p) 52 call void @left(i64 %p) 53 ret void 54} 55