[llvm] [InstCombine] InstCombine should fold frexp of select to select of frexp (PR #121227)

Yingwei Zheng via llvm-commits llvm-commits at lists.llvm.org
Mon Jan 6 21:50:19 PST 2025


================
@@ -4052,7 +4104,18 @@ Instruction *InstCombinerImpl::visitExtractValueInst(ExtractValueInst &EV) {
   if (Value *V = simplifyExtractValueInst(Agg, EV.getIndices(),
                                           SQ.getWithInstruction(&EV)))
     return replaceInstUsesWith(EV, V);
-
+  if (EV.getNumIndices() == 1 && EV.getIndices()[0] == 0) {
+    if (auto *FrexpCall = dyn_cast<IntrinsicInst>(Agg)) {
+      if (FrexpCall->getIntrinsicID() == Intrinsic::frexp) {
----------------
dtcxzyw wrote:

Please add one-use check on both select and frexp.


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


More information about the llvm-commits mailing list