[llvm] 0fb9f89 - [InstCombine] Initialize a SmallVector with a range (NFC) (#100947)

via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 14:31:54 PDT 2024


Author: Kazu Hirata
Date: 2024-07-28T14:31:51-07:00
New Revision: 0fb9f898e227925f43780bfe0e4887fba9fb1a15

URL: https://github.com/llvm/llvm-project/commit/0fb9f898e227925f43780bfe0e4887fba9fb1a15
DIFF: https://github.com/llvm/llvm-project/commit/0fb9f898e227925f43780bfe0e4887fba9fb1a15.diff

LOG: [InstCombine] Initialize a SmallVector with a range (NFC) (#100947)

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 e61480d7542d7..3d6b72e5775bd 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1500,10 +1500,7 @@ Instruction *InstCombinerImpl::visitCallInst(CallInst &CI) {
   // Don't try to simplify calls without uses. It will not do anything useful,
   // but will result in the following folds being skipped.
   if (!CI.use_empty()) {
-    SmallVector<Value *, 8> Args;
-    Args.reserve(CI.arg_size());
-    for (Value *Op : CI.args())
-      Args.push_back(Op);
+    SmallVector<Value *, 8> Args(CI.args());
     if (Value *V = simplifyCall(&CI, CI.getCalledOperand(), Args,
                                 SQ.getWithInstruction(&CI)))
       return replaceInstUsesWith(CI, V);


        


More information about the llvm-commits mailing list