Fixes the miscompilation discussed for the PR #164882 as part of generalizing the optimization for the issue #150120. Without this commit, MoveAutoInit moves the store instruction to a different branch which does not dominate the user dominator node. This results in UB at runtime. The example in the test case is specifically for an irreducible loop, in which all the predecessor may not dominate user dominator head. To fix this problem, we've introduced a new check to verify if the predecessor of the user dominator node does in fact dominate user dominator node before deciding that it is the node where the instruction will be moved to.
7.9 KiB
7.9 KiB