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

Phoebe Wang via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 5 21:47:47 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))
----------------
phoebewang wrote:

Why don't just check if type legal then? Maybe limited to scalar. I think it applies to other targets as well.

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


More information about the llvm-commits mailing list