[PATCH] D19554: Add optimization bisect opt-in calls for PowerPC passes

Andy Kaylor via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 26 13:00:43 PDT 2016


andrew.w.kaylor created this revision.
andrew.w.kaylor added a reviewer: hfinkel.
andrew.w.kaylor added a subscriber: llvm-commits.
andrew.w.kaylor set the repository for this revision to rL LLVM.

This patch adds calls to PowerPC-specific passes that can be safely skipped to opt-in to the optimization bisect mechanism.

I selected the passes to be skipped based on the fact that they were not added at CodeGenOpt::None in PPCTargetMachine.cpp. Based on that criteria, I did not add opt-in calls to the following passes, which appear to be required:

PPCBSel
PPCTOCRegDeps
PPCTLSDynamicCall
PPCVSXCopy
PPCVSXFMAMutate

I also chose not to add the skip check to PPCCTRLoopsVerify, but I'm not certain about this one.  This pass isn't run at -O0, so it meets the normal criteria for skipping, but since it is a verification function I decided not to add the skip check.  If this is verifying that transformations were performed in PPCCTRLoops, which can be skipped, then there is a potential problem.  If, on the other hand, it is simply verifying that the IR is legal following PPCCTRLoops then it should be fine to not skip it.

Note that the call to skipFunction() will also check for the "optnone" function attribute, so this can theoretically result in passes being skipped even when optimization bisect is not being done. However, I believe that any pass that can be safely skipped should be skipped for functions with the optnone attribute.

See D19172 for details on the base optimizaton bisect implementation.

Repository:
  rL LLVM

http://reviews.llvm.org/D19554

Files:
  lib/Target/PowerPC/PPCBoolRetToInt.cpp
  lib/Target/PowerPC/PPCCTRLoops.cpp
  lib/Target/PowerPC/PPCEarlyReturn.cpp
  lib/Target/PowerPC/PPCLoopPreIncPrep.cpp
  lib/Target/PowerPC/PPCMIPeephole.cpp
  lib/Target/PowerPC/PPCQPXLoadSplat.cpp
  lib/Target/PowerPC/PPCVSXSwapRemoval.cpp

Index: lib/Target/PowerPC/PPCBoolRetToInt.cpp
===================================================================
--- lib/Target/PowerPC/PPCBoolRetToInt.cpp
+++ lib/Target/PowerPC/PPCBoolRetToInt.cpp
@@ -168,6 +168,9 @@
   }
 
   bool runOnFunction(Function &F) {
+    if (skipFunction(F))
+      return false;
+
     PHINodeSet PromotablePHINodes = getPromotablePHINodes(F);
     B2IMap Bool2IntMap;
     bool Changed = false;
Index: lib/Target/PowerPC/PPCEarlyReturn.cpp
===================================================================
--- lib/Target/PowerPC/PPCEarlyReturn.cpp
+++ lib/Target/PowerPC/PPCEarlyReturn.cpp
@@ -173,6 +173,9 @@
 
 public:
     bool runOnMachineFunction(MachineFunction &MF) override {
+      if (skipFunction(*MF.getFunction()))
+        return false;
+
       TII = MF.getSubtarget().getInstrInfo();
 
       bool Changed = false;
Index: lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
===================================================================
--- lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
+++ lib/Target/PowerPC/PPCVSXSwapRemoval.cpp
@@ -191,6 +191,9 @@
 public:
   // Main entry point for this pass.
   bool runOnMachineFunction(MachineFunction &MF) override {
+    if (skipFunction(*MF.getFunction()))
+      return false;
+
     // If we don't have VSX on the subtarget, don't do anything.
     const PPCSubtarget &STI = MF.getSubtarget<PPCSubtarget>();
     if (!STI.hasVSX())
Index: lib/Target/PowerPC/PPCQPXLoadSplat.cpp
===================================================================
--- lib/Target/PowerPC/PPCQPXLoadSplat.cpp
+++ lib/Target/PowerPC/PPCQPXLoadSplat.cpp
@@ -60,6 +60,9 @@
 }
 
 bool PPCQPXLoadSplat::runOnMachineFunction(MachineFunction &MF) {
+  if (skipFunction(*MF.getFunction()))
+    return false;
+
   bool MadeChange = false;
   const TargetRegisterInfo *TRI = MF.getSubtarget().getRegisterInfo();
 
Index: lib/Target/PowerPC/PPCLoopPreIncPrep.cpp
===================================================================
--- lib/Target/PowerPC/PPCLoopPreIncPrep.cpp
+++ lib/Target/PowerPC/PPCLoopPreIncPrep.cpp
@@ -144,6 +144,9 @@
 }
 
 bool PPCLoopPreIncPrep::runOnFunction(Function &F) {
+  if (skipFunction(F))
+    return false;
+
   LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
   SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
   auto *DTWP = getAnalysisIfAvailable<DominatorTreeWrapperPass>();
Index: lib/Target/PowerPC/PPCMIPeephole.cpp
===================================================================
--- lib/Target/PowerPC/PPCMIPeephole.cpp
+++ lib/Target/PowerPC/PPCMIPeephole.cpp
@@ -63,6 +63,8 @@
 public:
   // Main entry point for this pass.
   bool runOnMachineFunction(MachineFunction &MF) override {
+    if (skipFunction(*MF.getFunction()))
+      return false;
     initialize(MF);
     return simplifyCode();
   }
Index: lib/Target/PowerPC/PPCCTRLoops.cpp
===================================================================
--- lib/Target/PowerPC/PPCCTRLoops.cpp
+++ lib/Target/PowerPC/PPCCTRLoops.cpp
@@ -166,6 +166,9 @@
 #endif // NDEBUG
 
 bool PPCCTRLoops::runOnFunction(Function &F) {
+  if (skipFunction(F))
+    return false;
+
   LI = &getAnalysis<LoopInfoWrapperPass>().getLoopInfo();
   SE = &getAnalysis<ScalarEvolutionWrapperPass>().getSE();
   DT = &getAnalysis<DominatorTreeWrapperPass>().getDomTree();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D19554.55074.patch
Type: text/x-patch
Size: 3329 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160426/d115a63b/attachment.bin>


More information about the llvm-commits mailing list