[llvm] [InstCombine] Use more inline elements in a SmallVector (PR #100942)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 28 10:33:59 PDT 2024


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/100942

The 4 inline elements only cover 58% of cases encountered here during
the compilation of X86ISelLowering.cpp.ll, a .ll version of
X86ISelLowering.cpp.

The 8 inline elements cover 96% and save 0.27% of heap allocations.


>From 49eadda15f9ff82980eb9d0b93b8815b51cfbe8f Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Sat, 27 Jul 2024 23:29:29 -0700
Subject: [PATCH] [InstCombine] Use more inline elements in a SmallVector

The 4 inline elements only cover 58% of cases encountered here during
the compilation of X86ISelLowering.cpp.ll, a .ll version of
X86ISelLowering.cpp.

The 8 inline elements cover 96% and save 0.27% of heap allocations.
---
 llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index f6c4b6e180937..e61480d7542d7 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -1500,7 +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 *, 4> Args;
+    SmallVector<Value *, 8> Args;
     Args.reserve(CI.arg_size());
     for (Value *Op : CI.args())
       Args.push_back(Op);



More information about the llvm-commits mailing list