Skip to content

Commit 72c901f

Browse files
committed
[TableGen] CodeGenIntrinsic - pass DefaultProperties as ArrayRef instead of std::vector by value.
Avoid std::vector copies as setDefaultProperties just iterates across the Records Fixes #89207
1 parent 9a7bd8a commit 72c901f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

llvm/utils/TableGen/Basic/CodeGenIntrinsics.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ CodeGenIntrinsicTable::CodeGenIntrinsicTable(const RecordKeeper &RC) {
5555
}
5656

5757
CodeGenIntrinsic::CodeGenIntrinsic(Record *R,
58-
std::vector<Record *> DefaultProperties) {
58+
ArrayRef<Record *> DefaultProperties) {
5959
TheDef = R;
6060
std::string DefName = std::string(R->getName());
6161
ArrayRef<SMLoc> DefLoc = R->getLoc();
@@ -148,7 +148,7 @@ CodeGenIntrinsic::CodeGenIntrinsic(Record *R,
148148
}
149149

150150
void CodeGenIntrinsic::setDefaultProperties(
151-
Record *R, std::vector<Record *> DefaultProperties) {
151+
Record *R, ArrayRef<Record *> DefaultProperties) {
152152
// opt-out of using default attributes.
153153
if (R->getValueAsBit("DisableDefaultAttributes"))
154154
return;

llvm/utils/TableGen/Basic/CodeGenIntrinsics.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#define LLVM_UTILS_TABLEGEN_CODEGENINTRINSICS_H
1515

1616
#include "SDNodeProperties.h"
17+
#include "llvm/ADT/ArrayRef.h"
1718
#include "llvm/ADT/SmallVector.h"
1819
#include "llvm/Support/ModRef.h"
1920
#include <string>
@@ -140,7 +141,7 @@ struct CodeGenIntrinsic {
140141

141142
/// Goes through all IntrProperties that have IsDefault
142143
/// value set and sets the property.
143-
void setDefaultProperties(Record *R, std::vector<Record *> DefaultProperties);
144+
void setDefaultProperties(Record *R, ArrayRef<Record *> DefaultProperties);
144145

145146
/// Helper function to set property \p Name to true;
146147
void setProperty(Record *R);
@@ -154,7 +155,7 @@ struct CodeGenIntrinsic {
154155

155156
bool isParamImmArg(unsigned ParamIdx) const;
156157

157-
CodeGenIntrinsic(Record *R, std::vector<Record *> DefaultProperties);
158+
CodeGenIntrinsic(Record *R, ArrayRef<Record *> DefaultProperties);
158159
};
159160

160161
class CodeGenIntrinsicTable {

0 commit comments

Comments
 (0)