This is to address the bug:
Currently, when selection dag tries to check whether two frame index
accesses alias to each other, it assumes it cannot alias if for two
different frame indices at least one is not fixed. This does not take into
account later frames can be reused if they are disjoint.
This issue is exposed to BPF as it uses ILP scheduler and x86 does
not have issue as it uses Source. Even x86 uses ILP, it does not
expose the issue as its target code is different from BPF.
I have a BPF backend patch to also use Source scheduler
and it fixed the issue. But I feel this is not the right fix and
it appears to me that the optimized dag does not sound right.
The patch fixed the issue by assuming two frames may alias due to
possible future stack reuse. The fix caused some failures
for X86 target due to different code sequence. Will fix tests
once we got consensus about what is the right fix for this problem.
TODO: fix tests
tested with llvm/tests and found the following failures on x86:
Failed Tests (25): LLVM :: CodeGen/X86/2008-05-12-tailmerge-5.ll LLVM :: CodeGen/X86/alias-static-alloca.ll LLVM :: CodeGen/X86/arg-copy-elide-win64.ll LLVM :: CodeGen/X86/atomic-fp.ll LLVM :: CodeGen/X86/atomic-mi.ll ...