[llvm] [IR] Use SmallVector::append to replace a loop. (PR #143586)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 12:08:05 PDT 2025
https://github.com/topperc created https://github.com/llvm/llvm-project/pull/143586
None
>From f37dc74d255a25abd47df68f7fe77396d08a040e Mon Sep 17 00:00:00 2001
From: Craig Topper <craig.topper at sifive.com>
Date: Tue, 10 Jun 2025 12:06:50 -0700
Subject: [PATCH] [IR] Use SmallVector::append to replace a loop.
---
llvm/lib/IR/Instructions.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp
index b29969657e7fc..54d779b28d05b 100644
--- a/llvm/lib/IR/Instructions.cpp
+++ b/llvm/lib/IR/Instructions.cpp
@@ -1865,8 +1865,7 @@ void ShuffleVectorInst::getShuffleMask(const Constant *Mask,
assert((isa<ConstantAggregateZero>(Mask) || isa<UndefValue>(Mask)) &&
"Scalable vector shuffle mask must be undef or zeroinitializer");
int MaskVal = isa<UndefValue>(Mask) ? -1 : 0;
- for (unsigned I = 0; I < EC.getKnownMinValue(); ++I)
- Result.emplace_back(MaskVal);
+ Result.append(EC.getKnownMinValue(), MaskVal);
return;
}
More information about the llvm-commits
mailing list