[llvm] [X86] Set up the framework for optimization of CCMP/CTEST (PR #84603)

via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 8 21:17:00 PST 2024


================
@@ -3377,7 +3377,9 @@ X86TargetLowering::getJumpConditionMergingParams(Instruction::BinaryOps Opc,
                                                  const Value *Lhs,
                                                  const Value *Rhs) const {
   using namespace llvm::PatternMatch;
-  int BaseCost = BrMergingBaseCostThresh.getValue();
+  // Disable condition merging when CCMP is available b/c we can eliminate
+  // branches in a more efficient way.
+  int BaseCost = Subtarget.hasCCMP() ? -1 : BrMergingBaseCostThresh.getValue();
----------------
goldsteinn wrote:

Would have figured it would be easier to just lower `(and/or setcc, setcc)` as `cmpp` than essentially restitching the BBs at the MBB level (which seems to have some extra restricts IIUC `canConvert` correctly).

https://github.com/llvm/llvm-project/pull/84603


More information about the llvm-commits mailing list