[llvm] 09d70e0 - [InstCombine] simplify code for FP to integer casts; NFCI

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Fri May 8 07:16:07 PDT 2020


Author: Sanjay Patel
Date: 2020-05-08T10:14:03-04:00
New Revision: 09d70e058853ee8f7f599d328bf2a20f2e0c0e71

URL: https://github.com/llvm/llvm-project/commit/09d70e058853ee8f7f599d328bf2a20f2e0c0e71
DIFF: https://github.com/llvm/llvm-project/commit/09d70e058853ee8f7f599d328bf2a20f2e0c0e71.diff

LOG: [InstCombine] simplify code for FP to integer casts; NFCI

FoldIToFPtoI() returns immediately if the operand is not
an opposite cast instruction, so the extra checks in the
callers are redundant.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
index 5c748cade372..50d31cd216d6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCasts.cpp
@@ -1784,10 +1784,6 @@ Instruction *InstCombiner::FoldItoFPtoI(Instruction &FI) {
 }
 
 Instruction *InstCombiner::visitFPToUI(FPToUIInst &FI) {
-  Instruction *OpI = dyn_cast<Instruction>(FI.getOperand(0));
-  if (!OpI)
-    return commonCastTransforms(FI);
-
   if (Instruction *I = FoldItoFPtoI(FI))
     return I;
 
@@ -1795,10 +1791,6 @@ Instruction *InstCombiner::visitFPToUI(FPToUIInst &FI) {
 }
 
 Instruction *InstCombiner::visitFPToSI(FPToSIInst &FI) {
-  Instruction *OpI = dyn_cast<Instruction>(FI.getOperand(0));
-  if (!OpI)
-    return commonCastTransforms(FI);
-
   if (Instruction *I = FoldItoFPtoI(FI))
     return I;
 


        


More information about the llvm-commits mailing list