[PATCH] D129817: [SelectOpti] Auto-disable other cmov optis when the new select-opti pass is enabled

Sotiris Apostolakis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 14 16:21:46 PDT 2022


apostolakis created this revision.
Herald added subscribers: jsji, pengfei, hiraditya.
Herald added a project: All.
apostolakis retitled this revision from "[SelectOpti] Auto-disable other cmov optis when the select-opti pass is enabled" to "[SelectOpti] Auto-disable other cmov optis when the new select-opti pass is enabled".
apostolakis added a reviewer: davidxl.
apostolakis published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D129817

Files:
  llvm/lib/CodeGen/CodeGenPrepare.cpp
  llvm/lib/Target/X86/X86CmovConversion.cpp


Index: llvm/lib/Target/X86/X86CmovConversion.cpp
===================================================================
--- llvm/lib/Target/X86/X86CmovConversion.cpp
+++ llvm/lib/Target/X86/X86CmovConversion.cpp
@@ -67,6 +67,7 @@
 #include "llvm/Support/CommandLine.h"
 #include "llvm/Support/Debug.h"
 #include "llvm/Support/raw_ostream.h"
+#include "llvm/Target/CGPassBuilderOption.h"
 #include <algorithm>
 #include <cassert>
 #include <iterator>
@@ -167,6 +168,10 @@
   if (!EnableCmovConverter)
     return false;
 
+  // If the SelectOptimize pass is enabled, cmovs have already been optimized.
+  if (!getCGPassBuilderOption().DisableSelectOptimize)
+    return false;
+
   LLVM_DEBUG(dbgs() << "********** " << getPassName() << " : " << MF.getName()
                     << "**********\n");
 
Index: llvm/lib/CodeGen/CodeGenPrepare.cpp
===================================================================
--- llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -6715,6 +6715,10 @@
   if (DisableSelectToBranch)
     return false;
 
+  // If the SelectOptimize pass is enabled, selects have already been optimized.
+  if (!getCGPassBuilderOption().DisableSelectOptimize)
+    return false;
+
   // Find all consecutive select instructions that share the same condition.
   SmallVector<SelectInst *, 2> ASI;
   ASI.push_back(SI);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D129817.444833.patch
Type: text/x-patch
Size: 1359 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220714/333af417/attachment.bin>


More information about the llvm-commits mailing list