OSDN Git Service

[PowerPC] avoid verification failure due to PowerPC VSX Swap Removal pass
authorHiroshi Inoue <inouehrs@jp.ibm.com>
Wed, 13 Jun 2018 08:25:14 +0000 (08:25 +0000)
committerHiroshi Inoue <inouehrs@jp.ibm.com>
Wed, 13 Jun 2018 08:25:14 +0000 (08:25 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@334579 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCVSXSwapRemoval.cpp

index 2fe54a8..1e8a175 100644 (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;