[PATCH] D80538: [MachineVerifier] Add a new RewriteTied flag to fix verify two-address constraint error

Zhang Kang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 26 01:35:09 PDT 2020


ZhangKang created this revision.
ZhangKang added reviewers: hfinkel, echristo, efriedma, thegameg, stoklund, craig.topper, PowerPC, qcolombet, bjope, nemanjai, hiraditya.
ZhangKang added a project: LLVM.
Herald added a subscriber: wuzish.
ZhangKang added a comment.
ZhangKang edited the summary of this revision.

The TwoAddressInstructionPass will rewrite the tied to meet the RegConstraint.
For example:
The TwoAddressInstructionPass will rewrite below IR

  %10:gprc = RLWIMI killed %9:gprc(tied-def 0), killed %0:gprc, 1, 0, 30

to:

  %10:gprc = RLWIMI killed %10:gprc(tied-def 0), killed %0:gprc, 1, 0, 30


The TwoAddressInstructionPass and PHIElimination passes take the machine function out of SSA, and the TwoAddressInstructionPass 
pass is after the PHIElimination pass.
We should verify two-address constraints after TwoAddressInstructionPass pass has been run, But in the `MachineVerifier.cpp`, we will
verify two-address constraints when the machine function is SSA, this is not correct.
We must ensure that after TwoAddressInstructionPass has been run, we verify two-address constraints.

This verification bug has caused 4752 cases error if we enable all pass verification.

This patch adds a new RewriteTied flag to ensure we will verify two-address constraints after TwoAddressInstructionPass pass.
This patch can fix 4752 cases error for two-address constraint  verification.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80538

Files:
  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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80538.266114.patch
Type: text/x-patch
Size: 4216 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200526/b4dde8bd/attachment.bin>


More information about the llvm-commits mailing list