[PATCH] D63801: [PowerPC] Fixed missing change flag of emitRLDICWhenLoweringJumpTables

Kai Luo via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 25 22:25:37 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL364383: [PowerPC] Fixed missing change flag of emitRLDICWhenLoweringJumpTables (authored by lkail, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D63801?vs=206574&id=206583#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63801/new/

https://reviews.llvm.org/D63801

Files:
  llvm/trunk/lib/Target/PowerPC/PPCMIPeephole.cpp


Index: llvm/trunk/lib/Target/PowerPC/PPCMIPeephole.cpp
===================================================================
--- llvm/trunk/lib/Target/PowerPC/PPCMIPeephole.cpp
+++ llvm/trunk/lib/Target/PowerPC/PPCMIPeephole.cpp
@@ -94,7 +94,7 @@
   // Perform peepholes.
   bool eliminateRedundantCompare(void);
   bool eliminateRedundantTOCSaves(std::map<MachineInstr *, bool> &TOCSaves);
-  void emitRLDICWhenLoweringJumpTables(MachineInstr &MI);
+  bool emitRLDICWhenLoweringJumpTables(MachineInstr &MI);
   void UpdateTOCSaves(std::map<MachineInstr *, bool> &TOCSaves,
                       MachineInstr *MI);
 
@@ -761,7 +761,7 @@
         break;
       }
       case PPC::RLDICR: {
-        emitRLDICWhenLoweringJumpTables(MI);
+        Simplified = emitRLDICWhenLoweringJumpTables(MI);
         break;
       }
       }
@@ -1284,17 +1284,17 @@
 // We miss the opportunity to emit an RLDIC when lowering jump tables
 // since ISEL sees only a single basic block. When selecting, the clear
 // and shift left will be in different blocks.
-void PPCMIPeephole::emitRLDICWhenLoweringJumpTables(MachineInstr &MI) {
+bool PPCMIPeephole::emitRLDICWhenLoweringJumpTables(MachineInstr &MI) {
   if (MI.getOpcode() != PPC::RLDICR)
-    return;
+    return false;
 
   unsigned SrcReg = MI.getOperand(1).getReg();
   if (!TargetRegisterInfo::isVirtualRegister(SrcReg))
-    return;
+    return false;
 
   MachineInstr *SrcMI = MRI->getVRegDef(SrcReg);
   if (SrcMI->getOpcode() != PPC::RLDICL)
-    return;
+    return false;
 
   MachineOperand MOpSHSrc = SrcMI->getOperand(2);
   MachineOperand MOpMBSrc = SrcMI->getOperand(3);
@@ -1302,7 +1302,7 @@
   MachineOperand MOpMEMI = MI.getOperand(3);
   if (!(MOpSHSrc.isImm() && MOpMBSrc.isImm() && MOpSHMI.isImm() &&
         MOpMEMI.isImm()))
-    return;
+    return false;
 
   uint64_t SHSrc = MOpSHSrc.getImm();
   uint64_t MBSrc = MOpMBSrc.getImm();
@@ -1311,7 +1311,7 @@
   uint64_t NewSH = SHSrc + SHMI;
   uint64_t NewMB = MBSrc - SHMI;
   if (NewMB > 63 || NewSH > 63)
-    return;
+    return false;
 
   // The bits cleared with RLDICL are [0, MBSrc).
   // The bits cleared with RLDICR are (MEMI, 63].
@@ -1320,7 +1320,7 @@
   //
   // The bits cleared with RLDIC are [0, NewMB) and (63-NewSH, 63].
   if ((63 - NewSH) != MEMI)
-    return;
+    return false;
 
   LLVM_DEBUG(dbgs() << "Converting pair: ");
   LLVM_DEBUG(SrcMI->dump());
@@ -1334,6 +1334,7 @@
   LLVM_DEBUG(dbgs() << "To: ");
   LLVM_DEBUG(MI.dump());
   NumRotatesCollapsed++;
+  return true;
 }
 
 } // end default namespace


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63801.206583.patch
Type: text/x-patch
Size: 2552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190626/d100f89b/attachment.bin>


More information about the llvm-commits mailing list