If left unchecked, the SLPVecrtorizer can move loads/stores below a stackrestore. The move can cause issues if the loads/stores have pointer operands from allocas that are reset by the stackrestores. This patch adds the dependency check.
The check is conservative, in that it does not check if the pointer operands of the loads/stores are actually from allocas that may be reset. We did not observe any SPECCPU2017 performance degradation so this simple fix seems sufficient.
The test could have been added to llvm/test/Transforms/SLPVectorizer/X86/stacksave-dependence.ll, but that test has not been updated to use opaque pointers. I am not inclined to add tests that still use typed pointers, or to refactor llvm/test/Transforms/SLPVectorizer/X86/stacksave-dependence.ll to use opaque pointers in this patch. If desired, I will open a different patch to refactor and consolidate the tests.