[llvm] [GlobalIsel] Combine selects with constants (PR #76089)

Amara Emerson via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 2 00:21:43 PST 2024


Thorsten =?utf-8?q?Schütt?= <schuett at gmail.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/76089 at github.com>


================
@@ -6352,16 +6352,22 @@ bool CombinerHelper::tryFoldSelectOfConstants(GSelect *Select,
   LLT CondTy = MRI.getType(Select->getCondReg());
   LLT TrueTy = MRI.getType(Select->getTrueReg());
 
-  // Either both are scalars or both are vectors.
-  std::optional<APInt> TrueOpt = getConstantOrConstantSplatVector(True);
-  std::optional<APInt> FalseOpt = getConstantOrConstantSplatVector(False);
+  // Only do this before legalization to avoid conflicting with target-specific
+  // transforms in the other direction.
+  if (CondTy != LLT::scalar(1))
+    return false;
+
+  // Noth are scalars.
----------------
aemerson wrote:

typo "Noth"

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


More information about the llvm-commits mailing list