[llvm] [CodeGenPrepare][X86] hasMultipleConditionRegisters - don't sink larger than legal integer comparisons (PR #166564)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 5 11:29:38 PST 2025


================
@@ -1840,7 +1840,11 @@ bool CodeGenPrepare::unfoldPowerOf2Test(CmpInst *Cmp) {
 ///
 /// Return true if any changes are made.
 static bool sinkCmpExpression(CmpInst *Cmp, const TargetLowering &TLI) {
-  if (TLI.hasMultipleConditionRegisters(EVT::getEVT(Cmp->getType())))
+  std::optional<EVT> CmpVT;
+  if (Cmp->getOperand(0)->getType()->isIntegerTy())
+    CmpVT = EVT::getEVT(Cmp->getOperand(0)->getType());
+
+  if (TLI.hasMultipleConditionRegisters(EVT::getEVT(Cmp->getType()), CmpVT))
----------------
arsenm wrote:

Is this equivalent to just checking if the compared type is legal? 

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


More information about the llvm-commits mailing list