Fixes https://github.com/llvm/llvm-project/issues/63645.
While processing the DAG below, DAGCombiner will move t24 up and chain it to t13 (visitSTORE(), findBetterNeighborChains(), GatherAllAliases()) because thats the first node that aliases with it (according to GatherAllAliases()). This also means that the store is moved past t15.
This is wrong, by looking at t24 and it's operands you can see that it does alias with t15 (t22 is 0). The reason this happens is that the base pointers of the address arguments of t24 and t15 are FrameIndex:i64<0> and TargetFrameIndex:i64<0> respectively, they have different pointer values but are really pointing to the same address in the target function.
This later results in all stores initializing that stack slot being deleted and incorrect code is generated.
Initial selection DAG: %bb.0 'main:entry'
SelectionDAG has 41 nodes:
t3: i64 = Constant<0>
t8: i64 = add nuw FrameIndex:i64<0>, Constant:i64<4>
t0: ch,glue = EntryToken
t5: ch = store<(store (s32) into @c, !tbaa !6)> t0, Constant:i32<0>, GlobalAddress:i64<ptr @c> 0, undef:i64
t10: ch = lifetime.start<0 to 8> t5, TargetFrameIndex:i64<0>
t12: ch = store<(store (s32) into %ir.a.i, !tbaa !6)> t10, Constant:i32<50009>, FrameIndex:i64<0>, undef:i64
t13: ch = store<(store (s32) into %ir.arrayidx.i.1, !tbaa !6)> t12, Constant:i32<50009>, t8, undef:i64
t14: ch = lifetime.end<0 to 8> t13, TargetFrameIndex:i64<0>
t15: ch = lifetime.start<0 to 8> t14, TargetFrameIndex:i64<0>
t18: ch = store<(store (s64) into @p, !tbaa !13)> t15, Constant:i64<64>, GlobalAddress:i64<ptr @p> 0, undef:i64
t19: i32,ch = load<(dereferenceable load (s32) from @c, !tbaa !6)> t18, GlobalAddress:i64<ptr @c> 0, undef:i64
t20: i64 = zero_extend t19
t22: i64 = shl t20, Constant:i64<2>
t23: i64 = add FrameIndex:i64<0>, t22
t24: ch = store<(store (s32) into %ir.arrayidx.1.i, !tbaa !6)> t19:1, Constant:i32<50009>, t23, undef:i64
t26: i32 = add t19, Constant:i32<1>
t27: i64 = zero_extend t26
t28: i64 = shl t27, Constant:i64<2>
t29: i64 = add FrameIndex:i64<0>, t28
t30: ch = store<(store (s32) into %ir.arrayidx.1.i.1, !tbaa !6)> t24, Constant:i32<50009>, t29, undef:i64
t31: i32,ch = load<(dereferenceable load (s32) from %ir.arrayidx15.i, !tbaa !6)> t30, t8, undef:i64
t34: i1 = setcc t31, Constant:i32<42829>, setlt:ch
t36: i1 = xor t34, Constant:i1<-1>
t38: ch = brcond t30, t36, BasicBlock:ch<t.exit 0xe93b5a8>
t40: ch = br t38, BasicBlock:ch<if.then.1.i 0xe93b4a8>