[PATCH] D16088: PPC: Don't replace weighted branches with ISEL on some targets.

Kyle Butt via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 11 14:08:57 PST 2016


iteratee created this revision.
iteratee added a reviewer: hfinkel.
iteratee added a subscriber: llvm-commits.

On POWER7 and POWER8 an ISEL is comparatively slow compared to a
weighted branch. Don't replace a hinted branch with an ISEL on these
targets.

http://reviews.llvm.org/D16088

Files:
  lib/Target/PowerPC/PPCInstrInfo.cpp

Index: lib/Target/PowerPC/PPCInstrInfo.cpp
===================================================================
--- lib/Target/PowerPC/PPCInstrInfo.cpp
+++ lib/Target/PowerPC/PPCInstrInfo.cpp
@@ -695,6 +695,12 @@
   if (Cond[1].getReg() == PPC::CTR || Cond[1].getReg() == PPC::CTR8)
     return false;
 
+  const MachineFunction *MF = MBB.getParent();
+  auto SelectPred = static_cast<PPC::Predicate>(Cond[0].getImm());
+  if (isHintedPredicate(SelectPred) &&
+      MF->getSubtarget<PPCSubtarget>().hasSlowISEL())
+    return false;
+
   // Check register classes.
   const MachineRegisterInfo &MRI = MBB.getParent()->getRegInfo();
   const TargetRegisterClass *RC =


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D16088.44554.patch
Type: text/x-patch
Size: 667 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160111/02c0c6ab/attachment.bin>


More information about the llvm-commits mailing list