OSDN Git Service

[x86] Fix PR37100 by teaching the EFLAGS copy lowering to rewrite uses
authorChandler Carruth <chandlerc@gmail.com>
Wed, 18 Apr 2018 15:13:16 +0000 (15:13 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Wed, 18 Apr 2018 15:13:16 +0000 (15:13 +0000)
commit4c208ab0d79745e51886b3b14b97c3a1abd526f9
tree1fd00ba1740ccd7996cbf736389e21d0e88f5151
parentc5db21b2665bb1a9749ce4772ff2067a4af22917
[x86] Fix PR37100 by teaching the EFLAGS copy lowering to rewrite uses
across basic blocks in the limited cases where it is very straight
forward to do so.

This will also be useful for other places where we do some limited
EFLAGS propagation across CFG edges and need to handle copy rewrites
afterward. I think this is rapidly approaching the maximum we can and
should be doing here. Everything else begins to require either heroic
analysis to prove how to do PHI insertion manually, or somehow managing
arbitrary PHI-ing of EFLAGS with general PHI insertion. Neither of these
seem at all promising so if those cases come up, we'll almost certainly
need to rewrite the parts of LLVM that produce those patterns.

We do now require dominator trees in order to reliably diagnose patterns
that would require PHI nodes. This is a bit unfortunate but it seems
better than the completely mysterious crash we would get otherwise.

Differential Revision: https://reviews.llvm.org/D45673

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@330264 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/X86/X86FlagsCopyLowering.cpp
test/CodeGen/X86/O0-pipeline.ll
test/CodeGen/X86/O3-pipeline.ll
test/CodeGen/X86/copy-eflags.ll