[llvm] [InstCombine] InstCombine should fold frexp of select to select of frexp (PR #121227)
Matt Arsenault via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 5 21:13:44 PST 2025
================
@@ -4043,6 +4043,52 @@ InstCombinerImpl::foldExtractOfOverflowIntrinsic(ExtractValueInst &EV) {
return nullptr;
}
+static Value *foldFrexpOfSelect(ExtractValueInst &EV, CallInst *FrexpCall,
+ SelectInst *SelectInst,
+ InstCombiner::BuilderTy &Builder) {
+ // Helper to fold frexp of select to select of frexp.
+ Value *Cond = SelectInst->getCondition();
+ Value *TrueVal = SelectInst->getTrueValue();
+ Value *FalseVal = SelectInst->getFalseValue();
+ ConstantFP *ConstOp = nullptr;
+ Value *VarOp = nullptr;
+ bool ConstIsTrue = false;
+
+ if (auto *TrueConst = dyn_cast<ConstantFP>(TrueVal)) {
----------------
arsenm wrote:
This won't handle the vector case. It's recommended to use m_APFloat to handle the scalar or vector case
https://github.com/llvm/llvm-project/pull/121227
More information about the llvm-commits
mailing list