[llvm] r332887 - [InstCombine] remove fptrunc (select) code; NFCI

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Mon May 21 13:39:35 PDT 2018


Author: spatel
Date: Mon May 21 13:39:35 2018
New Revision: 332887

URL: http://llvm.org/viewvc/llvm-project?rev=332887&view=rev
Log:
[InstCombine] remove fptrunc (select) code; NFCI

This pattern is handled within commonCastTransforms(),
so the code here is dead AFAICT.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp?rev=332887&r1=332886&r2=332887&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineCasts.cpp Mon May 21 13:39:35 2018
@@ -1593,23 +1593,6 @@ Instruction *InstCombiner::visitFPTrunc(
     }
   }
 
-  // (fptrunc (select cond, R1, Cst)) -->
-  // (select cond, (fptrunc R1), (fptrunc Cst))
-  //
-  //  - but only if this isn't part of a min/max operation, else we'll
-  // ruin min/max canonical form which is to have the select and
-  // compare's operands be of the same type with no casts to look through.
-  Value *LHS, *RHS;
-  SelectInst *SI = dyn_cast<SelectInst>(FPT.getOperand(0));
-  if (SI &&
-      (isa<ConstantFP>(SI->getOperand(1)) ||
-       isa<ConstantFP>(SI->getOperand(2))) &&
-      matchSelectPattern(SI, LHS, RHS).Flavor == SPF_UNKNOWN) {
-    Value *LHSTrunc = Builder.CreateFPTrunc(SI->getOperand(1), Ty);
-    Value *RHSTrunc = Builder.CreateFPTrunc(SI->getOperand(2), Ty);
-    return SelectInst::Create(SI->getOperand(0), LHSTrunc, RHSTrunc);
-  }
-
   if (auto *II = dyn_cast<IntrinsicInst>(FPT.getOperand(0))) {
     switch (II->getIntrinsicID()) {
     default: break;




More information about the llvm-commits mailing list