[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
Wed Nov 5 12:30:58 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:

Very similar, we don't account for CondCode or anything like that. 

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


More information about the llvm-commits mailing list