[MachineVerifier] Add TiedOpsRewritten flag to fix verify two-address error
authorKang Zhang <shkzhang@cn.ibm.com>
Tue, 9 Jun 2020 07:39:42 +0000 (07:39 +0000)
committerKang Zhang <shkzhang@cn.ibm.com>
Tue, 9 Jun 2020 07:39:42 +0000 (07:39 +0000)
commit1b6602275d3f902a91e2eab28f2ac506372d9065
tree0e9a06f3ad551bb1bbb72789a21f10b9e0291a50
parent09d098506bb9e39d3b0284331a039c8e86eec6e3
[MachineVerifier] Add TiedOpsRewritten flag to fix verify two-address error

Summary:
Currently, MachineVerifier will attempt to verify that tied operands
satisfy register constraints as soon as the function is no longer in
SSA form. However, PHIElimination will take the function out of SSA
form while TwoAddressInstructionPass will actually rewrite tied operands
to match the constraints. PHIElimination runs first in the pipeline.
Therefore, whenever the MachineVerifier is run after PHIElimination,
it will encounter verification errors on any tied operands.

This patch adds a function property called TiedOpsRewritten that will be
set by TwoAddressInstructionPass and will control when the verifier checks
tied operands.

Reviewed By: nemanjai

Differential Revision: https://reviews.llvm.org/D80538
llvm/include/llvm/CodeGen/MachineFunction.h
llvm/lib/CodeGen/MachineFunction.cpp
llvm/lib/CodeGen/MachineVerifier.cpp
llvm/lib/CodeGen/TwoAddressInstructionPass.cpp
llvm/test/CodeGen/PowerPC/two-address-crash.mir