[llvm] 8af6997 - [InstCombine][NFC]Use only `replaceInstUsesWith`, NFC.

Alexey Bataev via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 8 14:01:13 PDT 2021


Author: Alexey Bataev
Date: 2021-07-08T13:58:30-07:00
New Revision: 8af69975af39867187dabc5a9e68ad68b53c46f9

URL: https://github.com/llvm/llvm-project/commit/8af69975af39867187dabc5a9e68ad68b53c46f9
DIFF: https://github.com/llvm/llvm-project/commit/8af69975af39867187dabc5a9e68ad68b53c46f9.diff

LOG: [InstCombine][NFC]Use only `replaceInstUsesWith`, NFC.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 2124e90cd6366..c7c89ba04d7f1 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1905,10 +1905,8 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
       unsigned IdxN = cast<ConstantInt>(Idx)->getZExtValue();
 
       // An insert that entirely overwrites Vec with SubVec is a nop.
-      if (VecNumElts == SubVecNumElts) {
-        replaceInstUsesWith(CI, SubVec);
-        return eraseInstFromFunction(CI);
-      }
+      if (VecNumElts == SubVecNumElts)
+        return replaceInstUsesWith(CI, SubVec);
 
       // Widen SubVec into a vector of the same width as Vec, since
       // shufflevector requires the two input vectors to be the same width.
@@ -1932,8 +1930,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
         Mask.push_back(i);
 
       Value *Shuffle = Builder.CreateShuffleVector(Vec, WidenShuffle, Mask);
-      replaceInstUsesWith(CI, Shuffle);
-      return eraseInstFromFunction(CI);
+      return replaceInstUsesWith(CI, Shuffle);
     }
     break;
   }
@@ -1962,8 +1959,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
         Mask.push_back(IdxN + i);
 
       Value *Shuffle = Builder.CreateShuffleVector(Vec, Mask);
-      replaceInstUsesWith(CI, Shuffle);
-      return eraseInstFromFunction(CI);
+      return replaceInstUsesWith(CI, Shuffle);
     }
     break;
   }
@@ -1990,8 +1986,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
                  "Expected or reduction.");
           Res = Builder.CreateIsNotNull(Res);
         }
-        replaceInstUsesWith(CI, Res);
-        return eraseInstFromFunction(CI);
+        return replaceInstUsesWith(CI, Res);
       }
     LLVM_FALLTHROUGH;
   }
@@ -2016,8 +2011,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
             if (Arg != Vect &&
                 cast<Instruction>(Arg)->getOpcode() == Instruction::SExt)
               Res = Builder.CreateNeg(Res);
-            replaceInstUsesWith(CI, Res);
-            return eraseInstFromFunction(CI);
+            return replaceInstUsesWith(CI, Res);;
           }
       }
     }


        


More information about the llvm-commits mailing list