[PATCH] D89149: [SelectionDAG] Fix alias checking with potential later stack reuse
Yonghong Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 9 10:24:45 PDT 2020
yonghong-song created this revision.
yonghong-song added reviewers: niravd, courbet.
Herald added subscribers: llvm-commits, pengfei, jfb, hiraditya.
Herald added a reviewer: ecnelises.
Herald added a project: LLVM.
yonghong-song requested review of this revision.
This is to address the bug:
https://bugs.llvm.org/show_bug.cgi?id=47591
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
https://reviews.llvm.org/D88525
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
...
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D89149
Files:
llvm/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp
llvm/test/CodeGen/BPF/selectiondag-bug.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D89149.297275.patch
Type: text/x-patch
Size: 6657 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201009/6523f2db/attachment.bin>
More information about the llvm-commits
mailing list