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 make sure that domination fixup is not done static allocas.
(Alternative of https://reviews.llvm.org/D33663)
It looks like this is the expression in question. This expression should have aggregate evaluation kind, not scalar. We don't need to reload aggregate expression evaluation results because they are represented with temporary allocas, and they don't have dominance problems. It seems like there is an incorrect call to PopCleanupBlocks somewhere, and that's where the real fix should be.