This is a follow up for the rL297084 which made sure that dominance is preserved during expression cleanup emission.
We ran into a case where dominance fixup code was inserting the store in the middle of allocas.
%x = alloca i32, align 4 store i32* %x, i32** %tmp.exprcleanup, align 4 ; <===== HERE %ref.tmp3 = alloca %struct.A, align 1 %agg.tmp5 = alloca %"struct.std::experimental::coroutines_v1::coroutine_handle.0", align 4 %tmp.exprcleanup = alloca i32*, align 4 %allocapt = bitcast i32 undef to i32 store i32 %0, i32* %.addr, align 4
This fix makes sure that if we are fixing up domination for an alloca instruction we will do it after the AllocaInsertPt
Posted an alternative fix here: https://reviews.llvm.org/D33733
This doesn't seem right, Inst could be a dynamic alloca. If it's static, we definitely don't need to store and reload it. All static allocas better be in the entry block... You might want to use isStaticAlloca, but that still feels like we're hacking around some deeper problem.