[llvm] [GlobalIsel] Combine selects with constants (PR #76089)
Thorsten Schütt via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 2 02:22:57 PST 2024
================
@@ -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;
----------------
tschuett wrote:
The text was inspired by the DAG combiner. I updated it.
https://github.com/llvm/llvm-project/pull/76089
More information about the llvm-commits
mailing list