146db4324SBill Wendling; RUN: llvm-diff %s %s 246db4324SBill Wendling 346db4324SBill Wendling; An initializer that has a GEP instruction in it won't match itself in 446db4324SBill Wendling; llvm-diff unless the a deep comparison is done on the initializer. 546db4324SBill Wendling 646db4324SBill Wendling@gv1 = external dso_local global [28 x i16], align 16 7*a273c408SFangrui Song@gv2 = private unnamed_addr constant [2 x ptr] [ptr @gv1, ptr poison], align 16 846db4324SBill Wendling 946db4324SBill Wendlingdefine void @foo() { 10*a273c408SFangrui Song %1 = getelementptr [2 x ptr], ptr @gv2, i64 0, i64 undef 1146db4324SBill Wendling ret void 1246db4324SBill Wendling} 1382694708SBill Wendling 1482694708SBill Wendling; A named structure may be renamed when the right module is read. This is due 1582694708SBill Wendling; to the LLParser being different between the left and right modules, and the 1682694708SBill Wendling; context renaming one. 1782694708SBill Wendling 1882694708SBill Wendling%struct.ty1 = type { i16, i16 } 1982694708SBill Wendling 2082694708SBill Wendling@gv3 = internal global [1 x %struct.ty1] [%struct.ty1 { i16 928, i16 0 }], align 16 2182694708SBill Wendling 2282694708SBill Wendlingdefine void @bar() { 23*a273c408SFangrui Song %1 = getelementptr [1 x %struct.ty1], ptr @gv3, i64 0, i64 undef 2482694708SBill Wendling ret void 2582694708SBill Wendling} 2682694708SBill Wendling 2782694708SBill Wendling; An initializer may reference the variable it's initializing via bitcast / 2882694708SBill Wendling; GEP. Check that it doesn't cause an infinite loop. 2982694708SBill Wendling 3082694708SBill Wendling%struct.mutex = type { %struct.list_head } 31*a273c408SFangrui Song%struct.list_head = type { ptr, ptr } 3282694708SBill Wendling 33*a273c408SFangrui Song@vmx_l1d_flush_mutex = internal global %struct.mutex { %struct.list_head { ptr getelementptr (i8, ptr @vmx_l1d_flush_mutex, i64 16), ptr getelementptr (i8, ptr @vmx_l1d_flush_mutex, i64 16) } }, align 8 3482694708SBill Wendling 3582694708SBill Wendlingdefine internal i32 @qux() { 36*a273c408SFangrui Song call void undef(ptr @vmx_l1d_flush_mutex) 3782694708SBill Wendling ret i32 undef 3882694708SBill Wendling} 39635288d2SBill Wendling 40635288d2SBill Wendling; An initializer could use itself as part of the initialization. 41635288d2SBill Wendling 42*a273c408SFangrui Song@kvm_debugfs_entries = internal global %struct.list_head { ptr @kvm_debugfs_entries, ptr @kvm_debugfs_entries }, align 8 43635288d2SBill Wendling 44635288d2SBill Wendlingdefine i64 @mux() { 45*a273c408SFangrui Song %1 = load ptr, ptr @kvm_debugfs_entries, align 8 46635288d2SBill Wendling ret i64 undef 47635288d2SBill Wendling} 48