[PowerPC] avoid verification failure due to PowerPC VSX Swap Removal pass

This patch fixes a failure in lnt tests with -verify-machineinstrs option.
When VSX Swap Removal pass swaps two register operands, it did not maintain kill flags associated with operands. This patch swaps flags as well as register number to avoid inconsistent kill flags information.

llvm-svn: 334579
This commit is contained in:
Hiroshi Inoue 2018-06-13 08:25:14 +00:00
parent 4adc88ed25
commit 9bffc94cf0
1 changed files with 6 additions and 0 deletions

View File

@ -878,6 +878,12 @@ void PPCVSXSwapRemoval::handleSpecialSwappables(int EntryIdx) {
MI->getOperand(1).setReg(Reg2);
MI->getOperand(2).setReg(Reg1);
// We also need to swap kill flag associated with the register.
bool IsKill1 = MI->getOperand(1).isKill();
bool IsKill2 = MI->getOperand(2).isKill();
MI->getOperand(1).setIsKill(IsKill2);
MI->getOperand(2).setIsKill(IsKill1);
LLVM_DEBUG(dbgs() << " Into: ");
LLVM_DEBUG(MI->dump());
break;