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

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Nov 6 05:53:37 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))
----------------
RKSimon wrote:

I had looked at that but the regressions on other targets wasn't something I wanted to start diving into - but I'll raise a PR for reference.

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


More information about the llvm-commits mailing list