55 lines · plain
1; RUN: opt %s -passes=mergefunc,globalopt -S -o - | FileCheck %s2 3; Make sure we don't crash on this example. This test is supposed to test that4; MergeFunctions clears its GlobalNumbers value map. If this map still contains5; entries when running globalopt and the MergeFunctions instance is still alive6; the optimization of @G would cause an assert because globalopt would do an7; RAUW on @G which still exists as an entry in the GlobalNumbers ValueMap which8; causes an assert in the ValueHandle call back because we are RAUWing with a9; different type (AllocaInst) than its key type (GlobalValue).10 11@G = internal global ptr null12@G2 = internal global ptr null13 14define i32 @main(i32 %argc, ptr %argv) norecurse {15; CHECK: alloca16 store ptr %argv, ptr @G17 ret i32 018}19 20define internal ptr @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 ptr, ptr @G26 ret ptr %tmp27}28 29define internal ptr @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 ptr, ptr @G235 ret ptr %tmp36}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 void45}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 void54}55